Full Code of hardmaru/neuralslimevolley for AI

master b35201a61bf0 cached
20 files
1.1 MB
359.2k tokens
113 symbols
1 requests
Download .txt
Showing preview only (1,198K chars total). Download the full file or copy to clipboard to get everything.
Repository: hardmaru/neuralslimevolley
Branch: master
Commit: b35201a61bf0
Files: 20
Total size: 1.1 MB

Directory structure:
gitextract_1prx5pti/

├── Readme.md
├── index.html
├── lib/
│   ├── box2d-camera.js
│   ├── box2d-helper.js
│   ├── box2d-html5.js
│   ├── convnetjs/
│   │   ├── convnet-min.js
│   │   ├── convnet.js
│   │   ├── deepqlearn.js
│   │   ├── ga.js
│   │   ├── util.js
│   │   └── vis.js
│   ├── orientation-0.03.js
│   ├── p5.dom.js
│   ├── p5.js
│   └── p5.sound.js
├── pro/
│   └── index.html
├── pro.html
├── slimevolley.js
├── slimevolley_pro.js
└── useful.js

================================================
FILE CONTENTS
================================================

================================================
FILE: Readme.md
================================================

# Neural Slime Volleyball

HTML5-JS Slime Volleyball clone.  AI agent is a trained recurrent neural network, trained using basic conventional neuroevolution techniques.  Neural network implemented using the [convnetjs](http://cs.stanford.edu/people/karpathy/convnetjs/) library.  It is very difficult to win!

See my blog post at [blog.otoro.net](http://blog.otoro.net/2015/03/28/neural-slime-volleyball/) for more information, or [otoro.net](http://otoro.net/slimevolley/) to actually play the game.

## online demo
- [Neural Slime Volleyball](http://otoro.net/slimevolley)

## Training

If you wish to experiment with adding extra AI modules, or just to see how the learning works, please edit both pro.html and the slimevolley_pro.js.  They are the versions I will use in the future.

Inside pro.html, you can switch on/off the training mode by changing trainingVersion = true/false

If it is running on training version, the most capable neural net, in the form of a JSON array is dumped to nn_gene on the screen every 50 training generations.  You can copy and paste that blob back into initGeneJSON as a quoted text inside slimevolley_pro.js to incorporate back into the game, and switching training mode back to false to play with the new trained network.

Have fun-

## License
GNU GPL v3


================================================
FILE: index.html
================================================
<html>
<head>
  <title>neural slime volleyball</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=320, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="description" content="ōtoro.net">
    <meta name="author" content="hardmaru">

    <!-- Bootstrap Core CSS - Uses Bootswatch Flatly Theme: http://bootswatch.com/flatly/ -->
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">

    <!-- extra styles -->
    <style>
    a {
        font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
        font-size: 2.0em;
        font-weight: 150;
        font-style: inherit;
        color: orange;
    }

    head {
      margin: 0;
      padding: 0;
    }
    body {
      margin: 0;
      padding: 0;
      font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
      font-weight: 100;
      display: none;
    }
    p {
      padding: 10px;
      font-family: Courier, "Helvetica Neue",Helvetica,Arial,sans-serif;
      font-weight: 100;
      font-size: 2.0em;
    }
    textarea {
      padding: 5;
      font-family: Courier, "Helvetica Neue",Helvetica,Arial,sans-serif;
      font-weight: 100;
      font-size: 0.5em;
    }
    #nn_weights { white-space: pre; }
    </style>


</head>
<body>

<a href="http://blog.otoro.net/2015/03/28/neural-slime-volleyball/" id="initTitle" target="_blank">neural slime volleyball</a>
<a href="http://blog.otoro.net/2015/03/28/neural-slime-volleyball/" id="finalTitle" target="_blank">&copy; <ruby>ōtoro</ruby>.net</a>
<p id="theHand"><span class="glyphicon glyphicon-hand-up"></span></p>
<!--
    <p id="nn_weights"></p>
-->
    <div id="p5Container">
    </div>



  <img src="img/neural_slime_volleyball.png" class="img-responsive" alt="" id="pageImage">

  <!-- jQuery -->
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
  <!-- Bootstrap Core JavaScript -->
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
  <script src="http://cdn.jsdelivr.net/mobile-detect.js/0.4.1/mobile-detect.min.js"></script>
  <script src="./lib/convnetjs/convnet.js"></script>
  <script src="./lib/convnetjs/ga.js"></script>

<script>

$("#pageImage").hide();

$("#initTitle").hide();
$("#theHand").hide();
$("#initTitle").css({ 
    "position": "absolute",
    "top": 8 + "px",
    "left": 24 + "px",
    });


$("#finalTitle").hide();
$("#finalTitle").css({ 
    "position": "absolute",
    "top": 8 + "px",
    "right": 24 + "px",
    "font-size": 1.5 +"em"
    });

setTimeout(function(){
  $("body").fadeIn(500);
  $("#theHand").fadeIn(500);
  $("#initTitle").fadeIn(500);
},0);

/*
setTimeout(function(){
  $("#theHand").fadeIn(1000);
},2000);
*/
setTimeout(function(){
    $("#initTitle").fadeOut(500);
    $("#finalTitle").fadeIn(500);
},10000);

setTimeout(function(){
    $("#theHand").fadeOut(1000);
},4000);

/*
setTimeout(function(){
    $("#mainNavBar").fadeOut(1000);
},4000);
*/

</script>

<script language="javascript" type="text/javascript" src="./lib/p5.js"></script>
<script language="javascript" type="text/javascript" src="./lib/p5.dom.js"></script>
<script language="javascript" type="text/javascript" src="useful.js"></script>
<script language="javascript" type="text/javascript" src="slimevolley.js"></script>

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-61361005-1', 'auto');
  ga('send', 'pageview');

</script>
</body>
</html>

================================================
FILE: lib/box2d-camera.js
================================================

// -----------------------------------------------------------------------------
// Scale Methods
// -----------------------------------------------------------------------------

// supposed to translate (x_b2, y_b2) -> (x_pixel, y_pixel).  everything else scaled by a factor of scaleFactor
var b2Camera = { 
  scaleFactor : 10,
  x_b2: 0,
  y_b2: 0,
  x_pixel: 0,
  y_pixel: 0
};

var gravity;
var gravityStrength = 20;

var scaleToWorld = function(a,b) {
  var newv;
  if (a instanceof box2d.b2Vec2) {
    newv = new box2d.b2Vec2();
    newv.x = (a.x-b2Camera.x_pixel)/b2Camera.scaleFactor+b2Camera.x_b2;
    newv.y = (a.y-b2Camera.y_pixel)/b2Camera.scaleFactor+b2Camera.y_b2;
    return newv;
  } else if ("undefined"!=typeof b) {
    newv = new box2d.b2Vec2();
    newv.x = (a-b2Camera.x_pixel)/b2Camera.scaleFactor+b2Camera.x_b2;
    newv.y = (b-b2Camera.y_pixel)/b2Camera.scaleFactor+b2Camera.y_b2;
    return newv;
  } else {
    return a/b2Camera.scaleFactor;
  }
};


var makeB2Vec2 = function(a,b) {
  var newv;
  newv = new box2d.b2Vec2();
  newv.x = (a)/1;
  newv.y = (b)/1;
  return newv;
};

var scaleToPixels = function(a,b) {
  var newv;
  if (a instanceof box2d.b2Vec2) {
    newv = new box2d.b2Vec2();
    newv.x = (a.x-b2Camera.x_b2)*b2Camera.scaleFactor+b2Camera.x_pixel;
    newv.y = (a.y-b2Camera.y_b2)*b2Camera.scaleFactor+b2Camera.y_pixel;
    return newv;
  } else if ("undefined"!=typeof b) {
    newv = new box2d.b2Vec2();
    newv.x = (a-b2Camera.x_b2)*b2Camera.scaleFactor+b2Camera.x_pixel;
    newv.y = (b-b2Camera.y_b2)*b2Camera.scaleFactor+b2Camera.y_pixel;
    return newv;
  } else {
    return a*b2Camera.scaleFactor;
  }
};

// -----------------------------------------------------------------------------
// Create Methods
// -----------------------------------------------------------------------------

var createWorld = function() {

	var worldAABB = new box2d.b2AABB();
	worldAABB.lowerBound.SetXY(-this.bounds, -this.bounds);
	worldAABB.upperBound.SetXY(this.bounds, this.bounds);
	gravity = new box2d.b2Vec2(0,gravityStrength);
	var doSleep = true;

	return new box2d.b2World(gravity, doSleep);
};

// -----------------------------------------------------------------------------
// Draw Methods
// -----------------------------------------------------------------------------

var debugDraw = function(canvas, scale, world) {

	var context = canvas.getContext('2d');
  var j, b, f;
  context.fillStyle = '#DDD';
  context.fillRect(0, 0, canvas.width, canvas.height);

	// Draw joints
	for( j=world.m_jointList; j; j=j.m_next) {
    context.lineWidth = 0.25;
    context.strokeStyle = '#00F';
    drawJoint(context, scale, world, j);
  }

	// Draw body shapes
	for( b=world.m_bodyList; b; b=b.m_next) {
		for( f = b.GetFixtureList(); f!==null; f=f.GetNext()) {  
      context.lineWidth = 0.5;
			context.strokeStyle = '#F00';
      drawShape(context, scale, world, b, f);
    }
  }
};

var drawJoint = function(context, scale, world, joint) {
	context.save();
  context.scale(scale,scale);
  context.lineWidth /= scale;

  var b1 = joint.m_bodyA;
  var b2 = joint.m_bodyB;
  var x1 = b1.GetPosition();
  var x2 = b2.GetPosition();
  var p1 = joint.GetAnchorA();
  var p2 = joint.GetAnchorB();

  context.beginPath();
  switch (joint.m_type) {
    case box2d.b2Joint.e_distanceJoint:
      context.moveTo(p1.x, p1.y);
      context.lineTo(p2.x, p2.y);
      break;
    default: {
      if (b1 == world.m_groundBody) {
        context.moveTo(p1.x, p1.y);
        context.lineTo(x2.x, x2.y);
      }
      else if (b2 == world.m_groundBody) {
        context.moveTo(p1.x, p1.y);
        context.lineTo(x1.x, x1.y);
      }
      else {
        context.moveTo(x1.x, x1.y);
        context.lineTo(p1.x, p1.y);
        context.lineTo(x2.x, x2.y);
        context.lineTo(p2.x, p2.y);
      }
    } break;
  }
  context.closePath();
  context.stroke();
  context.restore();
};

var drawShape = function(context, scale, world, body, fixture) {

  context.save();
  context.scale(scale,scale);

  var bPos = body.GetPosition();
  context.translate(bPos.x, bPos.y);
  context.rotate(body.GetAngleRadians());
  
  context.beginPath();
  context.lineWidth /= scale;

	var shape = fixture.m_shape;
  var i;
  switch(shape.m_type) {
    case box2d.b2ShapeType.e_circleShape: {
      var r = shape.m_radius;
      var segments = 16.0;
      var theta = 0.0;
      var dtheta = 2.0 * Math.PI / segments;

      context.moveTo(r, 0);
      for (i = 0; i < segments; i++) {
        context.lineTo(r + r * Math.cos(theta), r * Math.sin(theta));
        theta += dtheta;
      }
      context.lineTo(r, 0);
    } break;

    case box2d.b2ShapeType.e_polygonShape:
    case box2d.b2ShapeType.e_chainShape: {

      var vertices = shape.m_vertices;
      var vertexCount = shape.m_count;
      if (!vertexCount) return;

      context.moveTo(vertices[0].x, vertices[0].y);
      for (i = 0; i < vertexCount; i++)
        context.lineTo(vertices[i].x, vertices[i].y);
    } break;
  }

  context.closePath();
  context.stroke();
  context.restore();
};

================================================
FILE: lib/box2d-helper.js
================================================

// -----------------------------------------------------------------------------
// Scale Methods
// -----------------------------------------------------------------------------

var scaleFactor;

var scaleToWorld = function(a,b) {
  var newv;
  if (a instanceof box2d.b2Vec2) {
    newv = new box2d.b2Vec2();
    newv.x = (a.x)/scaleFactor;
    newv.y = (a.y)/scaleFactor;
    return newv;
  } else if ("undefined"!=typeof b) {
    newv = new box2d.b2Vec2();
    newv.x = (a)/scaleFactor;
    newv.y = (b)/scaleFactor;
    return newv;
  } else {
    return a/scaleFactor;
  }
};

var scaleToPixels = function(a,b) {
  var newv;
  if (a instanceof box2d.b2Vec2) {
    newv = new box2d.b2Vec2();
    newv.x = a.x*scaleFactor;
    newv.y = a.y*scaleFactor;
    return newv;
  } else if ("undefined"!=typeof b) {
    newv = new box2d.b2Vec2();
    newv.x = a*scaleFactor;
    newv.y = b*scaleFactor;
    return newv;
  } else {
    return a*scaleFactor;
  }
};

// -----------------------------------------------------------------------------
// Create Methods
// -----------------------------------------------------------------------------

var createWorld = function() {

	var worldAABB = new box2d.b2AABB();
	worldAABB.lowerBound.SetXY(-this.bounds, -this.bounds);
	worldAABB.upperBound.SetXY(this.bounds, this.bounds);
	var gravity = new box2d.b2Vec2(0,20);
	var doSleep = true;

  scaleFactor = 10;

	return new box2d.b2World(gravity, doSleep);
};

// -----------------------------------------------------------------------------
// Draw Methods
// -----------------------------------------------------------------------------

var debugDraw = function(canvas, scale, world) {

	var context = canvas.getContext('2d');
  var j, b, f;
  context.fillStyle = '#DDD';
  context.fillRect(0, 0, canvas.width, canvas.height);

	// Draw joints
	for( j=world.m_jointList; j; j=j.m_next) {
    context.lineWidth = 0.25;
    context.strokeStyle = '#00F';
    drawJoint(context, scale, world, j);
  }

	// Draw body shapes
	for( b=world.m_bodyList; b; b=b.m_next) {
		for( f = b.GetFixtureList(); f!==null; f=f.GetNext()) {  
      context.lineWidth = 0.5;
			context.strokeStyle = '#F00';
      drawShape(context, scale, world, b, f);
    }
  }
};

var drawJoint = function(context, scale, world, joint) {
	context.save();
  context.scale(scale,scale);
  context.lineWidth /= scale;

  var b1 = joint.m_bodyA;
  var b2 = joint.m_bodyB;
  var x1 = b1.GetPosition();
  var x2 = b2.GetPosition();
  var p1 = joint.GetAnchorA();
  var p2 = joint.GetAnchorB();

  context.beginPath();
  switch (joint.m_type) {
    case box2d.b2Joint.e_distanceJoint:
      context.moveTo(p1.x, p1.y);
      context.lineTo(p2.x, p2.y);
      break;
    default: {
      if (b1 == world.m_groundBody) {
        context.moveTo(p1.x, p1.y);
        context.lineTo(x2.x, x2.y);
      }
      else if (b2 == world.m_groundBody) {
        context.moveTo(p1.x, p1.y);
        context.lineTo(x1.x, x1.y);
      }
      else {
        context.moveTo(x1.x, x1.y);
        context.lineTo(p1.x, p1.y);
        context.lineTo(x2.x, x2.y);
        context.lineTo(p2.x, p2.y);
      }
    } break;
  }
  context.closePath();
  context.stroke();
  context.restore();
};

var drawShape = function(context, scale, world, body, fixture) {

  context.save();
  context.scale(scale,scale);

  var bPos = body.GetPosition();
  context.translate(bPos.x, bPos.y);
  context.rotate(body.GetAngleRadians());
  
  context.beginPath();
  context.lineWidth /= scale;

	var shape = fixture.m_shape;
  var i;
  switch(shape.m_type) {
    case box2d.b2ShapeType.e_circleShape: {
      var r = shape.m_radius;
      var segments = 16.0;
      var theta = 0.0;
      var dtheta = 2.0 * Math.PI / segments;

      context.moveTo(r, 0);
      for (i = 0; i < segments; i++) {
        context.lineTo(r + r * Math.cos(theta), r * Math.sin(theta));
        theta += dtheta;
      }
      context.lineTo(r, 0);
    } break;

    case box2d.b2ShapeType.e_polygonShape:
    case box2d.b2ShapeType.e_chainShape: {

      var vertices = shape.m_vertices;
      var vertexCount = shape.m_count;
      if (!vertexCount) return;

      context.moveTo(vertices[0].x, vertices[0].y);
      for (i = 0; i < vertexCount; i++)
        context.lineTo(vertices[i].x, vertices[i].y);
    } break;
  }

  context.closePath();
  context.stroke();
  context.restore();
};

================================================
FILE: lib/box2d-html5.js
================================================
var COMPILED=!0,goog=goog||{};goog.global=this;goog.DEBUG=!1;goog.LOCALE="en";goog.TRUSTED_SITE=!0;goog.provide=function(a){if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a];for(var b=a;(b=b.substring(0,b.lastIndexOf(".")))&&!goog.getObjectByName(b);)goog.implicitNamespaces_[b]=!0}goog.exportPath_(a)};
goog.setTestOnly=function(a){if(COMPILED&&!goog.DEBUG)throw a=a||"",Error("Importing test-only code into non-debug environment"+a?": "+a:".");};COMPILED||(goog.isProvided_=function(a){return!goog.implicitNamespaces_[a]&&!!goog.getObjectByName(a)},goog.implicitNamespaces_={});goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var e;a.length&&(e=a.shift());)!a.length&&goog.isDef(b)?c[e]=b:c=c[e]?c[e]:c[e]={}};
goog.getObjectByName=function(a,b){for(var c=a.split("."),e=b||goog.global,d;d=c.shift();)if(goog.isDefAndNotNull(e[d]))e=e[d];else return null;return e};goog.globalize=function(a,b){var c=b||goog.global,e;for(e in a)c[e]=a[e]};
goog.addDependency=function(a,b,c){if(!COMPILED){var e;a=a.replace(/\\/g,"/");for(var d=goog.dependencies_,f=0;e=b[f];f++)d.nameToPath[e]=a,a in d.pathToNames||(d.pathToNames[a]={}),d.pathToNames[a][e]=!0;for(e=0;b=c[e];e++)a in d.requires||(d.requires[a]={}),d.requires[a][b]=!0}};goog.ENABLE_DEBUG_LOADER=!0;
goog.require=function(a){if(!COMPILED&&!goog.isProvided_(a)){if(goog.ENABLE_DEBUG_LOADER){var b=goog.getPathFromDeps_(a);if(b){goog.included_[b]=!0;goog.writeScripts_();return}}a="goog.require could not find: "+a;goog.global.console&&goog.global.console.error(a);throw Error(a);}};goog.basePath="";goog.nullFunction=function(){};goog.identityFunction=function(a,b){return a};goog.abstractMethod=function(){throw Error("unimplemented abstract method");};
goog.addSingletonGetter=function(a){a.getInstance=function(){if(a.instance_)return a.instance_;goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=a);return a.instance_=new a}};goog.instantiatedSingletons_=[];
!COMPILED&&goog.ENABLE_DEBUG_LOADER&&(goog.included_={},goog.dependencies_={pathToNames:{},nameToPath:{},requires:{},visited:{},written:{}},goog.inHtmlDocument_=function(){var a=goog.global.document;return"undefined"!=typeof a&&"write"in a},goog.findBasePath_=function(){if(goog.global.CLOSURE_BASE_PATH)goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var a=goog.global.document.getElementsByTagName("script"),b=a.length-1;0<=b;--b){var c=a[b].src,e=c.lastIndexOf("?"),e=
-1==e?c.length:e;if("base.js"==c.substr(e-7,7)){goog.basePath=c.substr(0,e-7);break}}},goog.importScript_=function(a){var b=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_;!goog.dependencies_.written[a]&&b(a)&&(goog.dependencies_.written[a]=!0)},goog.writeScriptTag_=function(a){if(goog.inHtmlDocument_()){var b=goog.global.document;if("complete"==b.readyState){if(/\bdeps.js$/.test(a))return!1;throw Error('Cannot write "'+a+'" after document load');}b.write('<script type="text/javascript" src="'+
a+'">\x3c/script>');return!0}return!1},goog.writeScripts_=function(){function a(d){if(!(d in e.written)){if(!(d in e.visited)&&(e.visited[d]=!0,d in e.requires))for(var g in e.requires[d])if(!goog.isProvided_(g))if(g in e.nameToPath)a(e.nameToPath[g]);else throw Error("Undefined nameToPath for "+g);d in c||(c[d]=!0,b.push(d))}}var b=[],c={},e=goog.dependencies_,d;for(d in goog.included_)e.written[d]||a(d);for(d=0;d<b.length;d++)if(b[d])goog.importScript_(goog.basePath+b[d]);else throw Error("Undefined script input");
},goog.getPathFromDeps_=function(a){return a in goog.dependencies_.nameToPath?goog.dependencies_.nameToPath[a]:null},goog.findBasePath_(),goog.global.CLOSURE_NO_DEPS||goog.importScript_(goog.basePath+"deps.js"));
goog.typeOf=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b};goog.isDef=function(a){return void 0!==a};goog.isNull=function(a){return null===a};goog.isDefAndNotNull=function(a){return null!=a};goog.isArray=function(a){return"array"==goog.typeOf(a)};goog.isArrayLike=function(a){var b=goog.typeOf(a);return"array"==b||"object"==b&&"number"==typeof a.length};goog.isDateLike=function(a){return goog.isObject(a)&&"function"==typeof a.getFullYear};goog.isString=function(a){return"string"==typeof a};
goog.isBoolean=function(a){return"boolean"==typeof a};goog.isNumber=function(a){return"number"==typeof a};goog.isFunction=function(a){return"function"==goog.typeOf(a)};goog.isObject=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b};goog.getUid=function(a){return a[goog.UID_PROPERTY_]||(a[goog.UID_PROPERTY_]=++goog.uidCounter_)};goog.removeUid=function(a){"removeAttribute"in a&&a.removeAttribute(goog.UID_PROPERTY_);try{delete a[goog.UID_PROPERTY_]}catch(b){}};
goog.UID_PROPERTY_="closure_uid_"+(1E9*Math.random()>>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid;goog.removeHashCode=goog.removeUid;goog.cloneObject=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if(a.clone)return a.clone();var b="array"==b?[]:{},c;for(c in a)b[c]=goog.cloneObject(a[c]);return b}return a};goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments)};
goog.bindJs_=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var e=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,e);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}};goog.bind=function(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bind=goog.bindNative_:goog.bind=goog.bindJs_;return goog.bind.apply(null,arguments)};
goog.partial=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.unshift.apply(b,c);return a.apply(this,b)}};goog.mixin=function(a,b){for(var c in b)a[c]=b[c]};goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date};
goog.globalEval=function(a){if(goog.global.execScript)goog.global.execScript(a,"JavaScript");else if(goog.global.eval)if(null==goog.evalWorksForGlobals_&&(goog.global.eval("var _et_ = 1;"),"undefined"!=typeof goog.global._et_?(delete goog.global._et_,goog.evalWorksForGlobals_=!0):goog.evalWorksForGlobals_=!1),goog.evalWorksForGlobals_)goog.global.eval(a);else{var b=goog.global.document,c=b.createElement("script");c.type="text/javascript";c.defer=!1;c.appendChild(b.createTextNode(a));b.body.appendChild(c);
b.body.removeChild(c)}else throw Error("goog.globalEval not available");};goog.evalWorksForGlobals_=null;goog.getCssName=function(a,b){var c=function(a){return goog.cssNameMapping_[a]||a},e=function(a){a=a.split("-");for(var b=[],e=0;e<a.length;e++)b.push(c(a[e]));return b.join("-")},e=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?c:e:function(a){return a};return b?a+"-"+e(b):e(a)};goog.setCssNameMapping=function(a,b){goog.cssNameMapping_=a;goog.cssNameMappingStyle_=b};
!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING);goog.getMsg=function(a,b){var c=b||{},e;for(e in c){var d=(""+c[e]).replace(/\$/g,"$$$$");a=a.replace(RegExp("\\{\\$"+e+"\\}","gi"),d)}return a};goog.getMsgWithFallback=function(a,b){return a};goog.exportSymbol=function(a,b,c){goog.exportPath_(a,b,c)};goog.exportProperty=function(a,b,c){a[b]=c};
goog.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a};
goog.base=function(a,b,c){var e=arguments.callee.caller;if(e.superClass_)return e.superClass_.constructor.apply(a,Array.prototype.slice.call(arguments,1));for(var d=Array.prototype.slice.call(arguments,2),f=!1,g=a.constructor;g;g=g.superClass_&&g.superClass_.constructor)if(g.prototype[b]===e)f=!0;else if(f)return g.prototype[b].apply(a,d);if(a[b]===e)return a.constructor.prototype[b].apply(a,d);throw Error("goog.base called from a method of one name to a method of a different name");};
goog.scope=function(a){a.call(goog.global)};var box2d={b2Settings:{}};Object.defineProperty||(Object.defineProperty=function(a,b,c){Object.__defineGetter__&&("get"in c?a.__defineGetter__(b,c.get):"value"in c&&a.__defineGetter__(b,c.value));Object.__defineSetter__&&("set"in c?a.__defineSetter__(b,c.set):"value"in c&&a.__defineSetter__(b,c.value))});box2d.DEBUG=!1;goog.exportSymbol("box2d.DEBUG",box2d.DEBUG);box2d.ENABLE_ASSERTS=box2d.DEBUG;goog.exportSymbol("box2d.ENABLE_ASSERTS",box2d.ENABLE_ASSERTS);
box2d.b2Assert=function(a,b,c){if(box2d.DEBUG&&!a)debugger};goog.exportSymbol("box2d.b2Assert",box2d.b2Assert);box2d.b2_maxFloat=1E37;goog.exportSymbol("box2d.b2_maxFloat",box2d.b2_maxFloat);box2d.b2_epsilon=1E-5;goog.exportSymbol("box2d.b2_epsilon",box2d.b2_epsilon);box2d.b2_epsilon_sq=box2d.b2_epsilon*box2d.b2_epsilon;goog.exportSymbol("box2d.b2_epsilon_sq",box2d.b2_epsilon_sq);box2d.b2_pi=Math.PI;goog.exportSymbol("box2d.b2_pi",box2d.b2_pi);box2d.b2_maxManifoldPoints=2;
goog.exportSymbol("box2d.b2_maxManifoldPoints",box2d.b2_maxManifoldPoints);box2d.b2_maxPolygonVertices=8;goog.exportSymbol("box2d.b2_maxPolygonVertices",box2d.b2_maxPolygonVertices);box2d.b2_aabbExtension=0.1;goog.exportSymbol("box2d.b2_aabbExtension",box2d.b2_aabbExtension);box2d.b2_aabbMultiplier=2;goog.exportSymbol("box2d.b2_aabbMultiplier",box2d.b2_aabbMultiplier);box2d.b2_linearSlop=0.008;goog.exportSymbol("box2d.b2_linearSlop",box2d.b2_linearSlop);box2d.b2_angularSlop=2/180*box2d.b2_pi;
goog.exportSymbol("box2d.b2_angularSlop",box2d.b2_angularSlop);box2d.b2_polygonRadius=2*box2d.b2_linearSlop;goog.exportSymbol("box2d.b2_polygonRadius",box2d.b2_polygonRadius);box2d.b2_maxSubSteps=8;goog.exportSymbol("box2d.b2_maxSubSteps",box2d.b2_maxSubSteps);box2d.b2_maxTOIContacts=32;goog.exportSymbol("box2d.b2_maxTOIContacts",box2d.b2_maxTOIContacts);box2d.b2_velocityThreshold=1;goog.exportSymbol("box2d.b2_velocityThreshold",box2d.b2_velocityThreshold);box2d.b2_maxLinearCorrection=0.2;
goog.exportSymbol("box2d.b2_maxLinearCorrection",box2d.b2_maxLinearCorrection);box2d.b2_maxAngularCorrection=8/180*box2d.b2_pi;goog.exportSymbol("box2d.b2_maxAngularCorrection",box2d.b2_maxAngularCorrection);box2d.b2_maxTranslation=2;goog.exportSymbol("box2d.b2_maxTranslation",box2d.b2_maxTranslation);box2d.b2_maxTranslationSquared=box2d.b2_maxTranslation*box2d.b2_maxTranslation;goog.exportSymbol("box2d.b2_maxTranslationSquared",box2d.b2_maxTranslationSquared);box2d.b2_maxRotation=0.5*box2d.b2_pi;
goog.exportSymbol("box2d.b2_maxRotation",box2d.b2_maxRotation);box2d.b2_maxRotationSquared=box2d.b2_maxRotation*box2d.b2_maxRotation;goog.exportSymbol("box2d.b2_maxRotationSquared",box2d.b2_maxRotationSquared);box2d.b2_baumgarte=0.2;goog.exportSymbol("box2d.b2_baumgarte",box2d.b2_baumgarte);box2d.b2_toiBaumgarte=0.75;goog.exportSymbol("box2d.b2_toiBaumgarte",box2d.b2_toiBaumgarte);box2d.b2_timeToSleep=0.5;goog.exportSymbol("box2d.b2_timeToSleep",box2d.b2_timeToSleep);
box2d.b2_linearSleepTolerance=0.01;goog.exportSymbol("box2d.b2_linearSleepTolerance",box2d.b2_linearSleepTolerance);box2d.b2_angularSleepTolerance=2/180*box2d.b2_pi;goog.exportSymbol("box2d.b2_angularSleepTolerance",box2d.b2_angularSleepTolerance);box2d.b2Alloc=function(a){return null};goog.exportSymbol("box2d.b2Alloc",box2d.b2Alloc);box2d.b2Free=function(a){};goog.exportSymbol("box2d.b2Free",box2d.b2Free);box2d.b2Log=function(a){goog.global.console.log.apply(null,arguments)};
goog.exportSymbol("box2d.b2Log",box2d.b2Log);box2d.b2Version=function(a,b,c){this.major=a||0;this.minor=b||0;this.revision=c||0};goog.exportSymbol("box2d.b2Version",box2d.b2Version);box2d.b2Version.prototype.major=0;goog.exportProperty(box2d.b2Version.prototype,"major",box2d.b2Version.prototype.major);box2d.b2Version.prototype.minor=0;goog.exportProperty(box2d.b2Version.prototype,"minor",box2d.b2Version.prototype.minor);box2d.b2Version.prototype.revision=0;
goog.exportProperty(box2d.b2Version.prototype,"revision",box2d.b2Version.prototype.revision);box2d.b2Version.prototype.toString=function(){return this.major+"."+this.minor+"."+this.revision};goog.exportProperty(box2d.b2Version.prototype,"toString",box2d.b2Version.prototype.toString);box2d.b2_version=new box2d.b2Version(2,3,0);goog.exportSymbol("box2d.b2_version",box2d.b2_version);box2d.b2_changelist=278;goog.exportSymbol("box2d.b2_changelist",box2d.b2_changelist);
box2d.b2ParseInt=function(a){return parseInt(a,10)};goog.exportSymbol("box2d.b2ParseInt",box2d.b2ParseInt);box2d.b2ParseUInt=function(a){return box2d.b2Abs(parseInt(a,10))};goog.exportSymbol("box2d.b2ParseUInt",box2d.b2ParseUInt);box2d.b2MakeArray=function(a,b){void 0===a&&(a=0);var c=Array(a);if(void 0!==b)for(var e=0;e<a;++e)c[e]=b(e);return c};goog.exportSymbol("box2d.b2MakeArray",box2d.b2MakeArray);box2d.b2MakeNumberArray=function(a){return box2d.b2MakeArray(a,function(a){return 0})};
goog.exportSymbol("box2d.b2MakeNumberArray",box2d.b2MakeNumberArray);box2d.b2Math={};box2d.b2_pi_over_180=box2d.b2_pi/180;goog.exportSymbol("box2d.b2_pi_over_180",box2d.b2_pi_over_180);box2d.b2_180_over_pi=180/box2d.b2_pi;goog.exportSymbol("box2d.b2_180_over_pi",box2d.b2_180_over_pi);box2d.b2_two_pi=2*box2d.b2_pi;goog.exportSymbol("box2d.b2_two_pi",box2d.b2_two_pi);box2d.b2Abs=function(a){return 0>a?-a:a};goog.exportSymbol("box2d.b2Abs",box2d.b2Abs);box2d.b2Min=function(a,b){return a<b?a:b};goog.exportSymbol("box2d.b2Min",box2d.b2Min);
box2d.b2Max=function(a,b){return a>b?a:b};goog.exportSymbol("box2d.b2Max",box2d.b2Max);box2d.b2Clamp=function(a,b,c){return a<b?b:a>c?c:a};goog.exportSymbol("box2d.b2Clamp",box2d.b2Clamp);box2d.b2Swap=function(a,b){box2d.ENABLE_ASSERTS&&box2d.b2Assert(!1);var c=a[0];a[0]=b[0];b[0]=c};goog.exportSymbol("box2d.b2Swap",box2d.b2Swap);box2d.b2IsValid=function(a){return isFinite(a)};goog.exportSymbol("box2d.b2IsValid",box2d.b2IsValid);box2d.b2Sq=function(a){return a*a};goog.exportSymbol("box2d.b2Sq",box2d.b2Sq);
box2d.b2InvSqrt=function(a){return 1/Math.sqrt(a)};goog.exportSymbol("box2d.b2InvSqrt",box2d.b2InvSqrt);box2d.b2Sqrt=function(a){return Math.sqrt(a)};goog.exportSymbol("box2d.b2Sqrt",box2d.b2Sqrt);box2d.b2Pow=function(a,b){return Math.pow(a,b)};goog.exportSymbol("box2d.b2Pow",box2d.b2Pow);box2d.b2DegToRad=function(a){return a*box2d.b2_pi_over_180};goog.exportSymbol("box2d.b2DegToRad",box2d.b2DegToRad);box2d.b2RadToDeg=function(a){return a*box2d.b2_180_over_pi};
goog.exportSymbol("box2d.b2RadToDeg",box2d.b2RadToDeg);box2d.b2Cos=function(a){return Math.cos(a)};goog.exportSymbol("box2d.b2Cos",box2d.b2Cos);box2d.b2Sin=function(a){return Math.sin(a)};goog.exportSymbol("box2d.b2Sin",box2d.b2Sin);box2d.b2Acos=function(a){return Math.acos(a)};goog.exportSymbol("box2d.b2Acos",box2d.b2Acos);box2d.b2Asin=function(a){return Math.asin(a)};goog.exportSymbol("box2d.b2Asin",box2d.b2Asin);box2d.b2Atan2=function(a,b){return Math.atan2(a,b)};
goog.exportSymbol("box2d.b2Atan2",box2d.b2Atan2);box2d.b2NextPowerOfTwo=function(a){a|=a>>1&2147483647;a|=a>>2&1073741823;a|=a>>4&268435455;a|=a>>8&16777215;return(a|a>>16&65535)+1};goog.exportSymbol("box2d.b2NextPowerOfTwo",box2d.b2NextPowerOfTwo);box2d.b2IsPowerOfTwo=function(a){return 0<a&&0===(a&a-1)};goog.exportSymbol("box2d.b2IsPowerOfTwo",box2d.b2IsPowerOfTwo);box2d.b2Random=function(){return 2*Math.random()-1};goog.exportSymbol("box2d.b2Random",box2d.b2Random);
box2d.b2RandomRange=function(a,b){return(b-a)*Math.random()+a};goog.exportSymbol("box2d.b2RandomRange",box2d.b2RandomRange);box2d.b2Vec2=function(a,b){this.x=a||0;this.y=b||0};goog.exportSymbol("box2d.b2Vec2",box2d.b2Vec2);box2d.b2Vec2.prototype.x=0;goog.exportProperty(box2d.b2Vec2.prototype,"x",box2d.b2Vec2.prototype.x);box2d.b2Vec2.prototype.y=0;goog.exportProperty(box2d.b2Vec2.prototype,"y",box2d.b2Vec2.prototype.y);box2d.b2Vec2_zero=new box2d.b2Vec2;goog.exportSymbol("box2d.b2Vec2_zero",box2d.b2Vec2_zero);
box2d.b2Vec2.ZERO=new box2d.b2Vec2;goog.exportProperty(box2d.b2Vec2,"ZERO",box2d.b2Vec2.ZERO);box2d.b2Vec2.UNITX=new box2d.b2Vec2(1,0);goog.exportProperty(box2d.b2Vec2,"UNITX",box2d.b2Vec2.UNITX);box2d.b2Vec2.UNITY=new box2d.b2Vec2(0,1);goog.exportProperty(box2d.b2Vec2,"UNITY",box2d.b2Vec2.UNITY);box2d.b2Vec2.s_t0=new box2d.b2Vec2;goog.exportProperty(box2d.b2Vec2,"s_t0",box2d.b2Vec2.s_t0);box2d.b2Vec2.s_t1=new box2d.b2Vec2;goog.exportProperty(box2d.b2Vec2,"s_t1",box2d.b2Vec2.s_t1);
box2d.b2Vec2.s_t2=new box2d.b2Vec2;goog.exportProperty(box2d.b2Vec2,"s_t2",box2d.b2Vec2.s_t2);box2d.b2Vec2.s_t3=new box2d.b2Vec2;goog.exportProperty(box2d.b2Vec2,"s_t3",box2d.b2Vec2.s_t3);box2d.b2Vec2.MakeArray=function(a){return box2d.b2MakeArray(a,function(a){return new box2d.b2Vec2})};goog.exportProperty(box2d.b2Vec2,"MakeArray",box2d.b2Vec2.MakeArray);box2d.b2Vec2.prototype.Clone=function(){return new box2d.b2Vec2(this.x,this.y)};goog.exportProperty(box2d.b2Vec2.prototype,"Clone",box2d.b2Vec2.prototype.Clone);
box2d.b2Vec2.prototype.SetZero=function(){this.y=this.x=0;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SetZero",box2d.b2Vec2.prototype.SetZero);box2d.b2Vec2.prototype.SetXY=function(a,b){this.x=a;this.y=b;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SetXY",box2d.b2Vec2.prototype.SetXY);box2d.b2Vec2.prototype.Copy=function(a){this.x=a.x;this.y=a.y;return this};goog.exportProperty(box2d.b2Vec2.prototype,"Copy",box2d.b2Vec2.prototype.Copy);
box2d.b2Vec2.prototype.SelfAdd=function(a){this.x+=a.x;this.y+=a.y;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfAdd",box2d.b2Vec2.prototype.SelfAdd);box2d.b2Vec2.prototype.SelfAddXY=function(a,b){this.x+=a;this.y+=b;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfAddXY",box2d.b2Vec2.prototype.SelfAddXY);box2d.b2Vec2.prototype.SelfSub=function(a){this.x-=a.x;this.y-=a.y;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfSub",box2d.b2Vec2.prototype.SelfSub);
box2d.b2Vec2.prototype.SelfSubXY=function(a,b){this.x-=a;this.y-=b;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfSubXY",box2d.b2Vec2.prototype.SelfSubXY);box2d.b2Vec2.prototype.SelfMul=function(a){this.x*=a;this.y*=a;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfMul",box2d.b2Vec2.prototype.SelfMul);box2d.b2Vec2.prototype.SelfMulAdd=function(a,b){this.x+=a*b.x;this.y+=a*b.y;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfMulAdd",box2d.b2Vec2.prototype.SelfMulAdd);
box2d.b2Vec2.prototype.SelfMulSub=function(a,b){this.x-=a*b.x;this.y-=a*b.y;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfMulSub",box2d.b2Vec2.prototype.SelfMulSub);box2d.b2Vec2.prototype.Dot=function(a){return this.x*a.x+this.y*a.y};goog.exportProperty(box2d.b2Vec2.prototype,"Dot",box2d.b2Vec2.prototype.Dot);box2d.b2Vec2.prototype.Cross=function(a){return this.x*a.y-this.y*a.x};goog.exportProperty(box2d.b2Vec2.prototype,"Cross",box2d.b2Vec2.prototype.Cross);
box2d.b2Vec2.prototype.Length=function(){var a=this.x,b=this.y;return Math.sqrt(a*a+b*b)};goog.exportProperty(box2d.b2Vec2.prototype,"Length",box2d.b2Vec2.prototype.Length);box2d.b2Vec2.prototype.GetLength=box2d.b2Vec2.prototype.Length;goog.exportProperty(box2d.b2Vec2.prototype,"GetLength",box2d.b2Vec2.prototype.GetLength);box2d.b2Vec2.prototype.LengthSquared=function(){var a=this.x,b=this.y;return a*a+b*b};goog.exportProperty(box2d.b2Vec2.prototype,"LengthSquared",box2d.b2Vec2.prototype.LengthSquared);
box2d.b2Vec2.prototype.GetLengthSquared=box2d.b2Vec2.prototype.LengthSquared;goog.exportProperty(box2d.b2Vec2.prototype,"GetLengthSquared",box2d.b2Vec2.prototype.GetLengthSquared);box2d.b2Vec2.prototype.Normalize=function(){var a=this.GetLength();if(a>=box2d.b2_epsilon){var b=1/a;this.x*=b;this.y*=b}return a};goog.exportProperty(box2d.b2Vec2.prototype,"Normalize",box2d.b2Vec2.prototype.Normalize);
box2d.b2Vec2.prototype.SelfNormalize=function(){var a=this.GetLength();a>=box2d.b2_epsilon&&(a=1/a,this.x*=a,this.y*=a);return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfNormalize",box2d.b2Vec2.prototype.SelfNormalize);box2d.b2Vec2.prototype.SelfRotate=function(a,b){var c=this.x,e=this.y;this.x=a*c-b*e;this.y=b*c+a*e;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfRotate",box2d.b2Vec2.prototype.SelfRotate);
box2d.b2Vec2.prototype.SelfRotateRadians=function(a){return this.SelfRotate(Math.cos(a),Math.sin(a))};goog.exportProperty(box2d.b2Vec2.prototype,"SelfRotateRadians",box2d.b2Vec2.prototype.SelfRotateRadians);box2d.b2Vec2.prototype.SelfRotateDegrees=function(a){return this.SelfRotateRadians(box2d.b2DegToRad(a))};goog.exportProperty(box2d.b2Vec2.prototype,"SelfRotateDegrees",box2d.b2Vec2.prototype.SelfRotateDegrees);box2d.b2Vec2.prototype.IsValid=function(){return isFinite(this.x)&&isFinite(this.y)};
goog.exportProperty(box2d.b2Vec2.prototype,"IsValid",box2d.b2Vec2.prototype.IsValid);box2d.b2Vec2.prototype.SelfCrossVS=function(a){var b=this.x;this.x=a*this.y;this.y=-a*b;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfCrossVS",box2d.b2Vec2.prototype.SelfCrossVS);box2d.b2Vec2.prototype.SelfCrossSV=function(a){var b=this.x;this.x=-a*this.y;this.y=a*b;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfCrossSV",box2d.b2Vec2.prototype.SelfCrossSV);
box2d.b2Vec2.prototype.SelfMinV=function(a){this.x=box2d.b2Min(this.x,a.x);this.y=box2d.b2Min(this.y,a.y);return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfMinV",box2d.b2Vec2.prototype.SelfMinV);box2d.b2Vec2.prototype.SelfMaxV=function(a){this.x=box2d.b2Max(this.x,a.x);this.y=box2d.b2Max(this.y,a.y);return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfMaxV",box2d.b2Vec2.prototype.SelfMaxV);
box2d.b2Vec2.prototype.SelfAbs=function(){this.x=box2d.b2Abs(this.x);this.y=box2d.b2Abs(this.y);return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfAbs",box2d.b2Vec2.prototype.SelfAbs);box2d.b2Vec2.prototype.SelfNeg=function(){this.x=-this.x;this.y=-this.y;return this};goog.exportProperty(box2d.b2Vec2.prototype,"SelfNeg",box2d.b2Vec2.prototype.SelfNeg);box2d.b2Vec2.prototype.SelfSkew=function(){var a=this.x;this.x=-this.y;this.y=a;return this};
goog.exportProperty(box2d.b2Vec2.prototype,"SelfSkew",box2d.b2Vec2.prototype.SelfSkew);box2d.b2AbsV=function(a,b){b.x=box2d.b2Abs(a.x);b.y=box2d.b2Abs(a.y);return b};goog.exportSymbol("box2d.b2AbsV",box2d.b2AbsV);box2d.b2MinV=function(a,b,c){c.x=box2d.b2Min(a.x,b.x);c.y=box2d.b2Min(a.y,b.y);return c};goog.exportSymbol("box2d.b2MinV",box2d.b2MinV);box2d.b2MaxV=function(a,b,c){c.x=box2d.b2Max(a.x,b.x);c.y=box2d.b2Max(a.y,b.y);return c};goog.exportSymbol("box2d.b2MaxV",box2d.b2MaxV);
box2d.b2ClampV=function(a,b,c,e){e.x=box2d.b2Clamp(a.x,b.x,c.x);e.y=box2d.b2Clamp(a.y,b.y,c.y);return e};goog.exportSymbol("box2d.b2ClampV",box2d.b2ClampV);box2d.b2RotateV=function(a,b,c,e){var d=a.x;a=a.y;e.x=b*d-c*a;e.y=c*d+b*a;return e};goog.exportSymbol("box2d.b2RotateV",box2d.b2RotateV);box2d.b2RotateRadiansV=function(a,b,c){return box2d.b2RotateV(a,Math.cos(b),Math.sin(b),c)};goog.exportSymbol("box2d.b2RotateRadiansV",box2d.b2RotateRadiansV);
box2d.b2RotateDegreesV=function(a,b,c){return box2d.b2RotateRadiansV(a,box2d.b2DegToRad(b),c)};goog.exportSymbol("box2d.b2RotateDegreesV",box2d.b2RotateDegreesV);box2d.b2DotVV=function(a,b){return a.x*b.x+a.y*b.y};goog.exportSymbol("box2d.b2DotVV",box2d.b2DotVV);box2d.b2CrossVV=function(a,b){return a.x*b.y-a.y*b.x};goog.exportSymbol("box2d.b2CrossVV",box2d.b2CrossVV);box2d.b2CrossVS=function(a,b,c){var e=a.x;c.x=b*a.y;c.y=-b*e;return c};goog.exportSymbol("box2d.b2CrossVS",box2d.b2CrossVS);
box2d.b2CrossVOne=function(a,b){var c=a.x;b.x=a.y;b.y=-c;return b};goog.exportSymbol("box2d.b2CrossVOne",box2d.b2CrossVOne);box2d.b2CrossSV=function(a,b,c){var e=b.x;c.x=-a*b.y;c.y=a*e;return c};goog.exportSymbol("box2d.b2CrossSV",box2d.b2CrossSV);box2d.b2CrossOneV=function(a,b){var c=a.x;b.x=-a.y;b.y=c;return b};goog.exportSymbol("box2d.b2CrossOneV",box2d.b2CrossOneV);box2d.b2AddVV=function(a,b,c){c.x=a.x+b.x;c.y=a.y+b.y;return c};goog.exportSymbol("box2d.b2AddVV",box2d.b2AddVV);
box2d.b2SubVV=function(a,b,c){c.x=a.x-b.x;c.y=a.y-b.y;return c};goog.exportSymbol("box2d.b2SubVV",box2d.b2SubVV);box2d.b2MulSV=function(a,b,c){c.x=b.x*a;c.y=b.y*a;return c};goog.exportSymbol("box2d.b2MulSV",box2d.b2MulSV);box2d.b2AddVMulSV=function(a,b,c,e){e.x=a.x+b*c.x;e.y=a.y+b*c.y;return e};goog.exportSymbol("box2d.b2AddVMulSV",box2d.b2AddVMulSV);box2d.b2SubVMulSV=function(a,b,c,e){e.x=a.x-b*c.x;e.y=a.y-b*c.y;return e};goog.exportSymbol("box2d.b2SubVMulSV",box2d.b2SubVMulSV);
box2d.b2AddVCrossSV=function(a,b,c,e){var d=c.x;e.x=a.x-b*c.y;e.y=a.y+b*d;return e};goog.exportSymbol("box2d.b2AddVCrossSV",box2d.b2AddVCrossSV);box2d.b2MidVV=function(a,b,c){c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);return c};goog.exportSymbol("box2d.b2MidVV",box2d.b2MidVV);box2d.b2ExtVV=function(a,b,c){c.x=0.5*(b.x-a.x);c.y=0.5*(b.y-a.y);return c};goog.exportSymbol("box2d.b2ExtVV",box2d.b2ExtVV);box2d.b2IsEqualToV=function(a,b){return a.x===b.x&&a.y===b.y};goog.exportSymbol("box2d.b2IsEqualToV",box2d.b2IsEqualToV);
box2d.b2DistanceVV=function(a,b){var c=a.x-b.x,e=a.y-b.y;return Math.sqrt(c*c+e*e)};goog.exportSymbol("box2d.b2DistanceVV",box2d.b2DistanceVV);box2d.b2DistanceSquaredVV=function(a,b){var c=a.x-b.x,e=a.y-b.y;return c*c+e*e};goog.exportSymbol("box2d.b2DistanceSquaredVV",box2d.b2DistanceSquaredVV);box2d.b2NegV=function(a,b){b.x=-a.x;b.y=-a.y;return b};goog.exportSymbol("box2d.b2NegV",box2d.b2NegV);box2d.b2Vec3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};goog.exportSymbol("box2d.b2Vec3",box2d.b2Vec3);
box2d.b2Vec3.prototype.x=0;goog.exportProperty(box2d.b2Vec3.prototype,"x",box2d.b2Vec3.prototype.x);box2d.b2Vec3.prototype.y=0;goog.exportProperty(box2d.b2Vec3.prototype,"y",box2d.b2Vec3.prototype.y);box2d.b2Vec3.prototype.z=0;goog.exportProperty(box2d.b2Vec3.prototype,"z",box2d.b2Vec3.prototype.z);box2d.b2Vec3.ZERO=new box2d.b2Vec3;goog.exportProperty(box2d.b2Vec3,"ZERO",box2d.b2Vec3.ZERO);box2d.b2Vec3.s_t0=new box2d.b2Vec3;goog.exportProperty(box2d.b2Vec3,"s_t0",box2d.b2Vec3.s_t0);
box2d.b2Vec3.prototype.Clone=function(){return new box2d.b2Vec3(this.x,this.y,this.z)};goog.exportProperty(box2d.b2Vec3.prototype,"Clone",box2d.b2Vec3.prototype.Clone);box2d.b2Vec3.prototype.SetZero=function(){this.z=this.y=this.x=0;return this};goog.exportProperty(box2d.b2Vec3.prototype,"SetZero",box2d.b2Vec3.prototype.SetZero);box2d.b2Vec3.prototype.SetXYZ=function(a,b,c){this.x=a;this.y=b;this.z=c;return this};goog.exportProperty(box2d.b2Vec3.prototype,"SetXYZ",box2d.b2Vec3.prototype.SetXYZ);
box2d.b2Vec3.prototype.Copy=function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this};goog.exportProperty(box2d.b2Vec3.prototype,"Copy",box2d.b2Vec3.prototype.Copy);box2d.b2Vec3.prototype.SelfNeg=function(){this.x=-this.x;this.y=-this.y;this.z=-this.z;return this};goog.exportProperty(box2d.b2Vec3.prototype,"SelfNeg",box2d.b2Vec3.prototype.SelfNeg);box2d.b2Vec3.prototype.SelfAdd=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this};goog.exportProperty(box2d.b2Vec3.prototype,"SelfAdd",box2d.b2Vec3.prototype.SelfAdd);
box2d.b2Vec3.prototype.SelfAddXYZ=function(a,b,c){this.x+=a;this.y+=b;this.z+=c;return this};goog.exportProperty(box2d.b2Vec3.prototype,"SelfAddXYZ",box2d.b2Vec3.prototype.SelfAddXYZ);box2d.b2Vec3.prototype.SelfSub=function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this};goog.exportProperty(box2d.b2Vec3.prototype,"SelfSub",box2d.b2Vec3.prototype.SelfSub);box2d.b2Vec3.prototype.SelfSubXYZ=function(a,b,c){this.x-=a;this.y-=b;this.z-=c;return this};
goog.exportProperty(box2d.b2Vec3.prototype,"SelfSubXYZ",box2d.b2Vec3.prototype.SelfSubXYZ);box2d.b2Vec3.prototype.SelfMul=function(a){this.x*=a;this.y*=a;this.z*=a;return this};goog.exportProperty(box2d.b2Vec3.prototype,"SelfMul",box2d.b2Vec3.prototype.SelfMul);box2d.b2DotV3V3=function(a,b){return a.x*b.x+a.y*b.y+a.z*b.z};goog.exportSymbol("box2d.b2DotV3V3",box2d.b2DotV3V3);box2d.b2CrossV3V3=function(a,b,c){var e=a.x,d=a.y;a=a.z;var f=b.x,g=b.y;b=b.z;c.x=d*b-a*g;c.y=a*f-e*b;c.z=e*g-d*f;return c};
goog.exportSymbol("box2d.b2CrossV3V3",box2d.b2CrossV3V3);box2d.b2Mat22=function(){this.ex=new box2d.b2Vec2(1,0);this.ey=new box2d.b2Vec2(0,1)};goog.exportSymbol("box2d.b2Mat22",box2d.b2Mat22);box2d.b2Mat22.prototype.ex=null;goog.exportProperty(box2d.b2Mat22.prototype,"ex",box2d.b2Mat22.prototype.ex);box2d.b2Mat22.prototype.ey=null;goog.exportProperty(box2d.b2Mat22.prototype,"ey",box2d.b2Mat22.prototype.ey);box2d.b2Mat22.IDENTITY=new box2d.b2Mat22;goog.exportProperty(box2d.b2Mat22,"IDENTITY",box2d.b2Mat22.IDENTITY);
box2d.b2Mat22.prototype.Clone=function(){return(new box2d.b2Mat22).Copy(this)};goog.exportProperty(box2d.b2Mat22.prototype,"Clone",box2d.b2Mat22.prototype.Clone);box2d.b2Mat22.FromVV=function(a,b){return(new box2d.b2Mat22).SetVV(a,b)};goog.exportProperty(box2d.b2Mat22,"FromVV",box2d.b2Mat22.FromVV);box2d.b2Mat22.FromSSSS=function(a,b,c,e){return(new box2d.b2Mat22).SetSSSS(a,b,c,e)};goog.exportProperty(box2d.b2Mat22,"FromSSSS",box2d.b2Mat22.FromSSSS);box2d.b2Mat22.FromAngleRadians=function(a){return(new box2d.b2Mat22).SetAngleRadians(a)};
goog.exportProperty(box2d.b2Mat22,"FromAngleRadians",box2d.b2Mat22.FromAngleRadians);box2d.b2Mat22.prototype.SetSSSS=function(a,b,c,e){this.ex.SetXY(a,c);this.ey.SetXY(b,e);return this};goog.exportProperty(box2d.b2Mat22.prototype,"SetSSSS",box2d.b2Mat22.prototype.SetSSSS);box2d.b2Mat22.prototype.SetVV=function(a,b){this.ex.Copy(a);this.ey.Copy(b);return this};goog.exportProperty(box2d.b2Mat22.prototype,"SetVV",box2d.b2Mat22.prototype.SetVV);
box2d.b2Mat22.prototype.SetAngle=function(a){var b=Math.cos(a);a=Math.sin(a);this.ex.SetXY(b,a);this.ey.SetXY(-a,b);return this};goog.exportProperty(box2d.b2Mat22.prototype,"SetAngle",box2d.b2Mat22.prototype.SetAngle);box2d.b2Mat22.prototype.SetAngleRadians=box2d.b2Mat22.prototype.SetAngle;box2d.b2Mat22.prototype.SetAngleDegrees=function(a){return this.SetAngle(box2d.b2DegToRad(a))};box2d.b2Mat22.prototype.Copy=function(a){this.ex.Copy(a.ex);this.ey.Copy(a.ey);return this};
goog.exportProperty(box2d.b2Mat22.prototype,"Copy",box2d.b2Mat22.prototype.Copy);box2d.b2Mat22.prototype.SetIdentity=function(){this.ex.SetXY(1,0);this.ey.SetXY(0,1);return this};goog.exportProperty(box2d.b2Mat22.prototype,"SetIdentity",box2d.b2Mat22.prototype.SetIdentity);box2d.b2Mat22.prototype.SetZero=function(){this.ex.SetZero();this.ey.SetZero();return this};goog.exportProperty(box2d.b2Mat22.prototype,"SetZero",box2d.b2Mat22.prototype.SetZero);
box2d.b2Mat22.prototype.GetAngle=function(){return Math.atan2(this.ex.y,this.ex.x)};goog.exportProperty(box2d.b2Mat22.prototype,"GetAngle",box2d.b2Mat22.prototype.GetAngle);box2d.b2Mat22.prototype.GetAngleRadians=box2d.b2Mat22.prototype.GetAngle;box2d.b2Mat22.prototype.GetInverse=function(a){var b=this.ex.x,c=this.ey.x,e=this.ex.y,d=this.ey.y,f=b*d-c*e;0!==f&&(f=1/f);a.ex.x=f*d;a.ey.x=-f*c;a.ex.y=-f*e;a.ey.y=f*b;return a};goog.exportProperty(box2d.b2Mat22.prototype,"GetInverse",box2d.b2Mat22.prototype.GetInverse);
box2d.b2Mat22.prototype.Solve=function(a,b,c){var e=this.ex.x,d=this.ey.x,f=this.ex.y,g=this.ey.y,h=e*g-d*f;0!==h&&(h=1/h);c.x=h*(g*a-d*b);c.y=h*(e*b-f*a);return c};goog.exportProperty(box2d.b2Mat22.prototype,"Solve",box2d.b2Mat22.prototype.Solve);box2d.b2Mat22.prototype.SelfAbs=function(){this.ex.SelfAbs();this.ey.SelfAbs();return this};goog.exportProperty(box2d.b2Mat22.prototype,"SelfAbs",box2d.b2Mat22.prototype.SelfAbs);box2d.b2Mat22.prototype.SelfInv=function(){return this.GetInverse(this)};
goog.exportProperty(box2d.b2Mat22.prototype,"SelfInv",box2d.b2Mat22.prototype.SelfInv);box2d.b2Mat22.prototype.SelfAddM=function(a){this.ex.SelfAdd(a.ex);this.ey.SelfAdd(a.ey);return this};goog.exportProperty(box2d.b2Mat22.prototype,"SelfAddM",box2d.b2Mat22.prototype.SelfAddM);box2d.b2Mat22.prototype.SelfSubM=function(a){this.ex.SelfSub(a.ex);this.ey.SelfSub(a.ey);return this};goog.exportProperty(box2d.b2Mat22.prototype,"SelfSubM",box2d.b2Mat22.prototype.SelfSubM);
box2d.b2AbsM=function(a,b){var c=a.ex,e=a.ey;b.ex.x=box2d.b2Abs(c.x);b.ex.y=box2d.b2Abs(c.y);b.ey.x=box2d.b2Abs(e.x);b.ey.y=box2d.b2Abs(e.y);return b};goog.exportSymbol("box2d.b2AbsM",box2d.b2AbsM);box2d.b2MulMV=function(a,b,c){var e=a.ex;a=a.ey;var d=b.x;b=b.y;c.x=e.x*d+a.x*b;c.y=e.y*d+a.y*b;return c};goog.exportSymbol("box2d.b2MulMV",box2d.b2MulMV);box2d.b2MulTMV=function(a,b,c){var e=a.ex;a=a.ey;var d=b.x;b=b.y;c.x=e.x*d+e.y*b;c.y=a.x*d+a.y*b;return c};goog.exportSymbol("box2d.b2MulTMV",box2d.b2MulTMV);
box2d.b2AddMM=function(a,b,c){var e=a.ex;a=a.ey;var d=b.ex;b=b.ey;c.ex.x=e.x+d.x;c.ex.y=e.y+d.y;c.ey.x=a.x+b.x;c.ey.y=a.y+b.y;return c};goog.exportSymbol("box2d.b2AddMM",box2d.b2AddMM);box2d.b2MulMM=function(a,b,c){var e=a.ex.x,d=a.ex.y,f=a.ey.x;a=a.ey.y;var g=b.ex.x,h=b.ex.y,l=b.ey.x;b=b.ey.y;c.ex.x=e*g+f*h;c.ex.y=d*g+a*h;c.ey.x=e*l+f*b;c.ey.y=d*l+a*b;return c};goog.exportSymbol("box2d.b2MulMM",box2d.b2MulMM);
box2d.b2MulTMM=function(a,b,c){var e=a.ex.x,d=a.ex.y,f=a.ey.x;a=a.ey.y;var g=b.ex.x,h=b.ex.y,l=b.ey.x;b=b.ey.y;c.ex.x=e*g+d*h;c.ex.y=f*g+a*h;c.ey.x=e*l+d*b;c.ey.y=f*l+a*b;return c};goog.exportSymbol("box2d.b2MulTMM",box2d.b2MulTMM);box2d.b2Mat33=function(){this.ex=new box2d.b2Vec3(1,0,0);this.ey=new box2d.b2Vec3(0,1,0);this.ez=new box2d.b2Vec3(0,0,1)};goog.exportSymbol("box2d.b2Mat33",box2d.b2Mat33);box2d.b2Mat33.prototype.ex=null;goog.exportProperty(box2d.b2Mat33.prototype,"ex",box2d.b2Mat33.prototype.ex);
box2d.b2Mat33.prototype.ey=null;goog.exportProperty(box2d.b2Mat33.prototype,"ey",box2d.b2Mat33.prototype.ey);box2d.b2Mat33.prototype.ez=null;goog.exportProperty(box2d.b2Mat33.prototype,"ez",box2d.b2Mat33.prototype.ez);box2d.b2Mat33.IDENTITY=new box2d.b2Mat33;goog.exportProperty(box2d.b2Mat33,"IDENTITY",box2d.b2Mat33.IDENTITY);box2d.b2Mat33.prototype.Clone=function(){return(new box2d.b2Mat33).Copy(this)};goog.exportProperty(box2d.b2Mat33.prototype,"Clone",box2d.b2Mat33.prototype.Clone);
box2d.b2Mat33.prototype.SetVVV=function(a,b,c){this.ex.Copy(a);this.ey.Copy(b);this.ez.Copy(c);return this};goog.exportProperty(box2d.b2Mat33.prototype,"SetVVV",box2d.b2Mat33.prototype.SetVVV);box2d.b2Mat33.prototype.Copy=function(a){this.ex.Copy(a.ex);this.ey.Copy(a.ey);this.ez.Copy(a.ez);return this};goog.exportProperty(box2d.b2Mat33.prototype,"Copy",box2d.b2Mat33.prototype.Copy);box2d.b2Mat33.prototype.SetIdentity=function(){this.ex.SetXYZ(1,0,0);this.ey.SetXYZ(0,1,0);this.ez.SetXYZ(0,0,1);return this};
goog.exportProperty(box2d.b2Mat33.prototype,"SetIdentity",box2d.b2Mat33.prototype.SetIdentity);box2d.b2Mat33.prototype.SetZero=function(){this.ex.SetZero();this.ey.SetZero();this.ez.SetZero();return this};goog.exportProperty(box2d.b2Mat33.prototype,"SetZero",box2d.b2Mat33.prototype.SetZero);box2d.b2Mat33.prototype.SelfAddM=function(a){this.ex.SelfAdd(a.ex);this.ey.SelfAdd(a.ey);this.ez.SelfAdd(a.ez);return this};goog.exportProperty(box2d.b2Mat33.prototype,"SelfAddM",box2d.b2Mat33.prototype.SelfAddM);
box2d.b2Mat33.prototype.Solve33=function(a,b,c,e){var d=this.ex.x,f=this.ex.y,g=this.ex.z,h=this.ey.x,l=this.ey.y,k=this.ey.z,m=this.ez.x,n=this.ez.y,p=this.ez.z,q=d*(l*p-k*n)+f*(k*m-h*p)+g*(h*n-l*m);0!==q&&(q=1/q);e.x=q*(a*(l*p-k*n)+b*(k*m-h*p)+c*(h*n-l*m));e.y=q*(d*(b*p-c*n)+f*(c*m-a*p)+g*(a*n-b*m));e.z=q*(d*(l*c-k*b)+f*(k*a-h*c)+g*(h*b-l*a));return e};goog.exportProperty(box2d.b2Mat33.prototype,"Solve33",box2d.b2Mat33.prototype.Solve33);
box2d.b2Mat33.prototype.Solve22=function(a,b,c){var e=this.ex.x,d=this.ey.x,f=this.ex.y,g=this.ey.y,h=e*g-d*f;0!==h&&(h=1/h);c.x=h*(g*a-d*b);c.y=h*(e*b-f*a);return c};goog.exportProperty(box2d.b2Mat33.prototype,"Solve22",box2d.b2Mat33.prototype.Solve22);box2d.b2Mat33.prototype.GetInverse22=function(a){var b=this.ex.x,c=this.ey.x,e=this.ex.y,d=this.ey.y,f=b*d-c*e;0!==f&&(f=1/f);a.ex.x=f*d;a.ey.x=-f*c;a.ex.z=0;a.ex.y=-f*e;a.ey.y=f*b;a.ey.z=0;a.ez.x=0;a.ez.y=0;a.ez.z=0};
goog.exportProperty(box2d.b2Mat33.prototype,"GetInverse22",box2d.b2Mat33.prototype.GetInverse22);box2d.b2Mat33.prototype.GetSymInverse33=function(a){var b=box2d.b2DotV3V3(this.ex,box2d.b2CrossV3V3(this.ey,this.ez,box2d.b2Vec3.s_t0));0!==b&&(b=1/b);var c=this.ex.x,e=this.ey.x,d=this.ez.x,f=this.ey.y,g=this.ez.y,h=this.ez.z;a.ex.x=b*(f*h-g*g);a.ex.y=b*(d*g-e*h);a.ex.z=b*(e*g-d*f);a.ey.x=a.ex.y;a.ey.y=b*(c*h-d*d);a.ey.z=b*(d*e-c*g);a.ez.x=a.ex.z;a.ez.y=a.ey.z;a.ez.z=b*(c*f-e*e)};
goog.exportProperty(box2d.b2Mat33.prototype,"GetSymInverse33",box2d.b2Mat33.prototype.GetSymInverse33);box2d.b2MulM33V3=function(a,b,c){var e=b.x,d=b.y;b=b.z;c.x=a.ex.x*e+a.ey.x*d+a.ez.x*b;c.y=a.ex.y*e+a.ey.y*d+a.ez.y*b;c.z=a.ex.z*e+a.ey.z*d+a.ez.z*b;return c};goog.exportSymbol("box2d.b2MulM33V3",box2d.b2MulM33V3);box2d.b2MulM33XYZ=function(a,b,c,e,d){d.x=a.ex.x*b+a.ey.x*c+a.ez.x*e;d.y=a.ex.y*b+a.ey.y*c+a.ez.y*e;d.z=a.ex.z*b+a.ey.z*c+a.ez.z*e;return d};goog.exportSymbol("box2d.b2MulM33XYZ",box2d.b2MulM33XYZ);
box2d.b2MulM33V2=function(a,b,c){var e=b.x;b=b.y;c.x=a.ex.x*e+a.ey.x*b;c.y=a.ex.y*e+a.ey.y*b;return c};goog.exportSymbol("box2d.b2MulM33V2",box2d.b2MulM33V2);box2d.b2MulM33XY=function(a,b,c,e){e.x=a.ex.x*b+a.ey.x*c;e.y=a.ex.y*b+a.ey.y*c;return e};goog.exportSymbol("box2d.b2MulM33XY",box2d.b2MulM33XY);box2d.b2Rot=function(a){a&&(this.angle=a,this.s=Math.sin(a),this.c=Math.cos(a))};goog.exportSymbol("box2d.b2Rot",box2d.b2Rot);box2d.b2Rot.prototype.angle=0;
goog.exportProperty(box2d.b2Rot.prototype,"angle",box2d.b2Rot.prototype.angle);box2d.b2Rot.prototype.s=0;goog.exportProperty(box2d.b2Rot.prototype,"s",box2d.b2Rot.prototype.s);box2d.b2Rot.prototype.c=1;goog.exportProperty(box2d.b2Rot.prototype,"c",box2d.b2Rot.prototype.c);box2d.b2Rot.IDENTITY=new box2d.b2Rot;goog.exportProperty(box2d.b2Rot,"IDENTITY",box2d.b2Rot.IDENTITY);box2d.b2Rot.prototype.Clone=function(){return(new box2d.b2Rot).Copy(this)};goog.exportProperty(box2d.b2Rot.prototype,"Clone",box2d.b2Rot.prototype.Clone);
box2d.b2Rot.prototype.Copy=function(a){this.angle=a.angle;this.s=a.s;this.c=a.c;return this};goog.exportProperty(box2d.b2Rot.prototype,"Copy",box2d.b2Rot.prototype.Copy);box2d.b2Rot.prototype.SetAngle=function(a){this.angle!==a&&(this.angle=a,this.s=Math.sin(a),this.c=Math.cos(a));return this};goog.exportProperty(box2d.b2Rot.prototype,"SetAngle",box2d.b2Rot.prototype.SetAngle);box2d.b2Rot.prototype.SetAngleRadians=box2d.b2Rot.prototype.SetAngle;box2d.b2Rot.prototype.SetAngleDegrees=function(a){return this.SetAngle(box2d.b2DegToRad(a))};
box2d.b2Rot.prototype.SetIdentity=function(){this.s=this.angle=0;this.c=1;return this};goog.exportProperty(box2d.b2Rot.prototype,"SetIdentity",box2d.b2Rot.prototype.SetIdentity);box2d.b2Rot.prototype.GetAngle=function(){return this.angle};goog.exportProperty(box2d.b2Rot.prototype,"GetAngle",box2d.b2Rot.prototype.GetAngle);box2d.b2Rot.prototype.GetAngleRadians=box2d.b2Rot.prototype.GetAngle;box2d.b2Rot.prototype.GetAngleDegrees=function(){return box2d.b2RadToDeg(this.GetAngle())};
box2d.b2Rot.prototype.GetXAxis=function(a){a.x=this.c;a.y=this.s;return a};goog.exportProperty(box2d.b2Rot.prototype,"GetXAxis",box2d.b2Rot.prototype.GetXAxis);box2d.b2Rot.prototype.GetYAxis=function(a){a.x=-this.s;a.y=this.c;return a};goog.exportProperty(box2d.b2Rot.prototype,"GetYAxis",box2d.b2Rot.prototype.GetYAxis);
box2d.b2MulRR=function(a,b,c){var e=a.c,d=a.s,f=b.c,g=b.s;c.s=d*f+e*g;c.c=e*f-d*g;for(c.angle=a.angle+b.angle;c.angle<-box2d.b2_pi;)c.angle+=box2d.b2_two_pi;for(;c.angle>=box2d.b2_pi;)c.angle-=box2d.b2_two_pi;return c};goog.exportSymbol("box2d.b2MulRR",box2d.b2MulRR);box2d.b2MulTRR=function(a,b,c){var e=a.c,d=a.s,f=b.c,g=b.s;c.s=e*g-d*f;c.c=e*f+d*g;for(c.angle=a.angle-b.angle;c.angle<-box2d.b2_pi;)c.angle+=box2d.b2_two_pi;for(;c.angle>=box2d.b2_pi;)c.angle-=box2d.b2_two_pi;return c};
goog.exportSymbol("box2d.b2MulTRR",box2d.b2MulTRR);box2d.b2MulRV=function(a,b,c){var e=a.c;a=a.s;var d=b.x;b=b.y;c.x=e*d-a*b;c.y=a*d+e*b;return c};goog.exportSymbol("box2d.b2MulRV",box2d.b2MulRV);box2d.b2MulTRV=function(a,b,c){var e=a.c;a=a.s;var d=b.x;b=b.y;c.x=e*d+a*b;c.y=-a*d+e*b;return c};goog.exportSymbol("box2d.b2MulTRV",box2d.b2MulTRV);box2d.b2Transform=function(){this.p=new box2d.b2Vec2;this.q=new box2d.b2Rot};goog.exportSymbol("box2d.b2Transform",box2d.b2Transform);
box2d.b2Transform.prototype.p=null;goog.exportProperty(box2d.b2Transform.prototype,"p",box2d.b2Transform.prototype.p);box2d.b2Transform.prototype.q=null;goog.exportProperty(box2d.b2Transform.prototype,"q",box2d.b2Transform.prototype.q);box2d.b2Transform.IDENTITY=new box2d.b2Transform;goog.exportProperty(box2d.b2Transform,"IDENTITY",box2d.b2Transform.IDENTITY);box2d.b2Transform.prototype.Clone=function(){return(new box2d.b2Transform).Copy(this)};
goog.exportProperty(box2d.b2Transform.prototype,"Clone",box2d.b2Transform.prototype.Clone);box2d.b2Transform.prototype.Copy=function(a){this.p.Copy(a.p);this.q.Copy(a.q);return this};goog.exportProperty(box2d.b2Transform.prototype,"Copy",box2d.b2Transform.prototype.Copy);box2d.b2Transform.prototype.SetIdentity=function(){this.p.SetZero();this.q.SetIdentity();return this};goog.exportProperty(box2d.b2Transform.prototype,"SetIdentity",box2d.b2Transform.prototype.SetIdentity);
box2d.b2Transform.prototype.SetPositionRotation=function(a,b){this.p.Copy(a);this.q.Copy(b);return this};goog.exportProperty(box2d.b2Transform.prototype,"SetPositionRotation",box2d.b2Transform.prototype.SetPositionRotation);box2d.b2Transform.prototype.SetPositionAngleRadians=function(a,b){this.p.Copy(a);this.q.SetAngleRadians(b);return this};goog.exportProperty(box2d.b2Transform.prototype,"SetPositionAngleRadians",box2d.b2Transform.prototype.SetPositionAngleRadians);
box2d.b2Transform.prototype.SetPosition=function(a){this.p.Copy(a);return this};goog.exportProperty(box2d.b2Transform.prototype,"SetPosition",box2d.b2Transform.prototype.SetPosition);box2d.b2Transform.prototype.SetPositionXY=function(a,b){this.p.SetXY(a,b);return this};goog.exportProperty(box2d.b2Transform.prototype,"SetPositionXY",box2d.b2Transform.prototype.SetPositionXY);box2d.b2Transform.prototype.SetRotation=function(a){this.q.Copy(a);return this};
goog.exportProperty(box2d.b2Transform.prototype,"SetRotation",box2d.b2Transform.prototype.SetRotation);box2d.b2Transform.prototype.SetRotationAngleRadians=function(a){this.q.SetAngleRadians(a);return this};goog.exportProperty(box2d.b2Transform.prototype,"SetRotationAngleRadians",box2d.b2Transform.prototype.SetRotationAngleRadians);box2d.b2Transform.prototype.GetPosition=function(){return this.p};goog.exportProperty(box2d.b2Transform.prototype,"GetPosition",box2d.b2Transform.prototype.GetPosition);
box2d.b2Transform.prototype.GetRotation=function(){return this.q};goog.exportProperty(box2d.b2Transform.prototype,"GetRotation",box2d.b2Transform.prototype.GetRotation);box2d.b2Transform.prototype.GetRotationAngle=function(){return this.q.GetAngle()};goog.exportProperty(box2d.b2Transform.prototype,"GetRotationAngle",box2d.b2Transform.prototype.GetRotationAngle);box2d.b2Transform.prototype.GetRotationAngleRadians=box2d.b2Transform.prototype.GetRotationAngle;box2d.b2Transform.prototype.GetAngle=function(){return this.q.GetAngle()};
goog.exportProperty(box2d.b2Transform.prototype,"GetAngle",box2d.b2Transform.prototype.GetAngle);box2d.b2Transform.prototype.GetAngleRadians=box2d.b2Transform.prototype.GetAngle;box2d.b2MulXV=function(a,b,c){var e=a.q.c,d=a.q.s,f=b.x;b=b.y;c.x=e*f-d*b+a.p.x;c.y=d*f+e*b+a.p.y;return c};goog.exportSymbol("box2d.b2MulXV",box2d.b2MulXV);box2d.b2MulTXV=function(a,b,c){var e=a.q.c,d=a.q.s,f=b.x-a.p.x;a=b.y-a.p.y;c.x=e*f+d*a;c.y=-d*f+e*a;return c};goog.exportSymbol("box2d.b2MulTXV",box2d.b2MulTXV);
box2d.b2MulXX=function(a,b,c){box2d.b2MulRR(a.q,b.q,c.q);box2d.b2AddVV(box2d.b2MulRV(a.q,b.p,c.p),a.p,c.p);return c};goog.exportSymbol("box2d.b2MulXX",box2d.b2MulXX);box2d.b2MulTXX=function(a,b,c){box2d.b2MulTRR(a.q,b.q,c.q);box2d.b2MulTRV(a.q,box2d.b2SubVV(b.p,a.p,c.p),c.p);return c};goog.exportSymbol("box2d.b2MulTXX",box2d.b2MulTXX);box2d.b2Sweep=function(){this.localCenter=new box2d.b2Vec2;this.c0=new box2d.b2Vec2;this.c=new box2d.b2Vec2};goog.exportSymbol("box2d.b2Sweep",box2d.b2Sweep);
box2d.b2Sweep.prototype.localCenter=null;goog.exportProperty(box2d.b2Sweep.prototype,"localCenter",box2d.b2Sweep.prototype.localCenter);box2d.b2Sweep.prototype.c0=null;goog.exportProperty(box2d.b2Sweep.prototype,"c0",box2d.b2Sweep.prototype.c0);box2d.b2Sweep.prototype.c=null;goog.exportProperty(box2d.b2Sweep.prototype,"c",box2d.b2Sweep.prototype.c);box2d.b2Sweep.prototype.a0=0;goog.exportProperty(box2d.b2Sweep.prototype,"a0",box2d.b2Sweep.prototype.a0);box2d.b2Sweep.prototype.a=0;
goog.exportProperty(box2d.b2Sweep.prototype,"a",box2d.b2Sweep.prototype.a);box2d.b2Sweep.prototype.alpha0=0;goog.exportProperty(box2d.b2Sweep.prototype,"alpha0",box2d.b2Sweep.prototype.alpha0);box2d.b2Sweep.prototype.Clone=function(){return(new box2d.b2Sweep).Copy(this)};goog.exportProperty(box2d.b2Sweep.prototype,"Clone",box2d.b2Sweep.prototype.Clone);
box2d.b2Sweep.prototype.Copy=function(a){this.localCenter.Copy(a.localCenter);this.c0.Copy(a.c0);this.c.Copy(a.c);this.a0=a.a0;this.a=a.a;this.alpha0=a.alpha0;return this};goog.exportProperty(box2d.b2Sweep.prototype,"Copy",box2d.b2Sweep.prototype.Copy);box2d.b2Sweep.prototype.GetTransform=function(a,b){var c=1-b;a.p.x=c*this.c0.x+b*this.c.x;a.p.y=c*this.c0.y+b*this.c.y;a.q.SetAngleRadians(c*this.a0+b*this.a);a.p.SelfSub(box2d.b2MulRV(a.q,this.localCenter,box2d.b2Vec2.s_t0));return a};
goog.exportProperty(box2d.b2Sweep.prototype,"GetTransform",box2d.b2Sweep.prototype.GetTransform);box2d.b2Sweep.prototype.Advance=function(a){box2d.ENABLE_ASSERTS&&box2d.b2Assert(1>this.alpha0);var b=(a-this.alpha0)/(1-this.alpha0);this.c0.x+=b*(this.c.x-this.c0.x);this.c0.y+=b*(this.c.y-this.c0.y);this.a0+=b*(this.a-this.a0);this.alpha0=a};goog.exportProperty(box2d.b2Sweep.prototype,"Advance",box2d.b2Sweep.prototype.Advance);
box2d.b2Sweep.prototype.Normalize=function(){var a=box2d.b2_two_pi*Math.floor(this.a0/box2d.b2_two_pi);this.a0-=a;this.a-=a};goog.exportProperty(box2d.b2Sweep.prototype,"Normalize",box2d.b2Sweep.prototype.Normalize);box2d.b2ControllerEdge=function(){};goog.exportSymbol("box2d.b2ControllerEdge",box2d.b2ControllerEdge);box2d.b2ControllerEdge.prototype.controller=null;goog.exportProperty(box2d.b2ControllerEdge.prototype,"controller",box2d.b2ControllerEdge.prototype.controller);box2d.b2ControllerEdge.prototype.body=null;goog.exportProperty(box2d.b2ControllerEdge.prototype,"body",box2d.b2ControllerEdge.prototype.body);box2d.b2ControllerEdge.prototype.prevBody=null;
goog.exportProperty(box2d.b2ControllerEdge.prototype,"prevBody",box2d.b2ControllerEdge.prototype.prevBody);box2d.b2ControllerEdge.prototype.nextBody=null;goog.exportProperty(box2d.b2ControllerEdge.prototype,"nextBody",box2d.b2ControllerEdge.prototype.nextBody);box2d.b2ControllerEdge.prototype.prevController=null;goog.exportProperty(box2d.b2ControllerEdge.prototype,"prevController",box2d.b2ControllerEdge.prototype.prevController);box2d.b2ControllerEdge.prototype.nextController=null;
goog.exportProperty(box2d.b2ControllerEdge.prototype,"nextController",box2d.b2ControllerEdge.prototype.nextController);box2d.b2Controller=function(){};goog.exportSymbol("box2d.b2Controller",box2d.b2Controller);box2d.b2Controller.prototype.m_world=null;goog.exportProperty(box2d.b2Controller.prototype,"m_world",box2d.b2Controller.prototype.m_world);box2d.b2Controller.prototype.m_bodyList=null;goog.exportProperty(box2d.b2Controller.prototype,"m_bodyList",box2d.b2Controller.prototype.m_bodyList);
box2d.b2Controller.prototype.m_bodyCount=0;goog.exportProperty(box2d.b2Controller.prototype,"m_bodyCount",box2d.b2Controller.prototype.m_bodyCount);box2d.b2Controller.prototype.m_prev=null;goog.exportProperty(box2d.b2Controller.prototype,"m_prev",box2d.b2Controller.prototype.m_prev);box2d.b2Controller.prototype.m_next=null;goog.exportProperty(box2d.b2Controller.prototype,"m_next",box2d.b2Controller.prototype.m_next);box2d.b2Controller.prototype.Step=function(a){};
goog.exportProperty(box2d.b2Controller.prototype,"Step",box2d.b2Controller.prototype.Step);box2d.b2Controller.prototype.Draw=function(a){};goog.exportProperty(box2d.b2Controller.prototype,"Draw",box2d.b2Controller.prototype.Draw);box2d.b2Controller.prototype.GetNext=function(){return this.m_next};goog.exportProperty(box2d.b2Controller.prototype,"GetNext",box2d.b2Controller.prototype.GetNext);box2d.b2Controller.prototype.GetPrev=function(){return this.m_prev};
goog.exportProperty(box2d.b2Controller.prototype,"GetPrev",box2d.b2Controller.prototype.GetPrev);box2d.b2Controller.prototype.GetWorld=function(){return this.m_world};goog.exportProperty(box2d.b2Controller.prototype,"GetWorld",box2d.b2Controller.prototype.GetWorld);box2d.b2Controller.prototype.GetBodyList=function(){return this.m_bodyList};goog.exportProperty(box2d.b2Controller.prototype,"GetBodyList",box2d.b2Controller.prototype.GetBodyList);
box2d.b2Controller.prototype.AddBody=function(a){var b=new box2d.b2ControllerEdge;b.body=a;b.controller=this;b.nextBody=this.m_bodyList;b.prevBody=null;this.m_bodyList&&(this.m_bodyList.prevBody=b);this.m_bodyList=b;++this.m_bodyCount;b.nextController=a.m_controllerList;b.prevController=null;a.m_controllerList&&(a.m_controllerList.prevController=b);a.m_controllerList=b;++a.m_controllerCount};goog.exportProperty(box2d.b2Controller.prototype,"AddBody",box2d.b2Controller.prototype.AddBody);
box2d.b2Controller.prototype.RemoveBody=function(a){box2d.ENABLE_ASSERTS&&box2d.b2Assert(0<this.m_bodyCount);for(var b=this.m_bodyList;b&&b.body!==a;)b=b.nextBody;box2d.ENABLE_ASSERTS&&box2d.b2Assert(null!==b);b.prevBody&&(b.prevBody.nextBody=b.nextBody);b.nextBody&&(b.nextBody.prevBody=b.prevBody);this.m_bodyList===b&&(this.m_bodyList=b.nextBody);--this.m_bodyCount;b.nextController&&(b.nextController.prevController=b.prevController);b.prevController&&(b.prevController.nextController=b.nextController);
a.m_controllerList===b&&(a.m_controllerList=b.nextController);--a.m_controllerCount};goog.exportProperty(box2d.b2Controller.prototype,"RemoveBody",box2d.b2Controller.prototype.RemoveBody);box2d.b2Controller.prototype.Clear=function(){for(;this.m_bodyList;)this.RemoveBody(this.m_bodyList.body);this.m_bodyCount=0};goog.exportProperty(box2d.b2Controller.prototype,"Clear",box2d.b2Controller.prototype.Clear);box2d.b2ConstantAccelController=function(){box2d.b2Controller.call(this);this.A=new box2d.b2Vec2(0,0)};goog.inherits(box2d.b2ConstantAccelController,box2d.b2Controller);goog.exportSymbol("box2d.b2ConstantAccelController",box2d.b2ConstantAccelController);box2d.b2ConstantAccelController.prototype.A=null;goog.exportProperty(box2d.b2ConstantAccelController.prototype,"A",box2d.b2ConstantAccelController.prototype.A);
box2d.b2ConstantAccelController.prototype.Step=function(a){a=box2d.b2MulSV(a.dt,this.A,box2d.b2ConstantAccelController.prototype.Step.s_dtA);for(var b=this.m_bodyList;b;b=b.nextBody){var c=b.body;c.IsAwake()&&c.SetLinearVelocity(box2d.b2AddVV(c.GetLinearVelocity(),a,box2d.b2Vec2.s_t0))}};goog.exportProperty(box2d.b2ConstantAccelController.prototype,"Step",box2d.b2ConstantAccelController.prototype.Step);box2d.b2ConstantAccelController.prototype.Step.s_dtA=new box2d.b2Vec2;box2d.b2JointType={e_unknownJoint:0,e_revoluteJoint:1,e_prismaticJoint:2,e_distanceJoint:3,e_pulleyJoint:4,e_mouseJoint:5,e_gearJoint:6,e_wheelJoint:7,e_weldJoint:8,e_frictionJoint:9,e_ropeJoint:10,e_motorJoint:11,e_areaJoint:12};goog.exportSymbol("box2d.b2JointType",box2d.b2JointType);goog.exportProperty(box2d.b2JointType,"e_unknownJoint",box2d.b2JointType.e_unknownJoint);goog.exportProperty(box2d.b2JointType,"e_revoluteJoint",box2d.b2JointType.e_revoluteJoint);
goog.exportProperty(box2d.b2JointType,"e_prismaticJoint",box2d.b2JointType.e_prismaticJoint);goog.exportProperty(box2d.b2JointType,"e_distanceJoint",box2d.b2JointType.e_distanceJoint);goog.exportProperty(box2d.b2JointType,"e_pulleyJoint",box2d.b2JointType.e_pulleyJoint);goog.exportProperty(box2d.b2JointType,"e_mouseJoint",box2d.b2JointType.e_mouseJoint);goog.exportProperty(box2d.b2JointType,"e_gearJoint",box2d.b2JointType.e_gearJoint);goog.exportProperty(box2d.b2JointType,"e_wheelJoint",box2d.b2JointType.e_wheelJoint);
goog.exportProperty(box2d.b2JointType,"e_weldJoint",box2d.b2JointType.e_weldJoint);goog.exportProperty(box2d.b2JointType,"e_frictionJoint",box2d.b2JointType.e_frictionJoint);goog.exportProperty(box2d.b2JointType,"e_ropeJoint",box2d.b2JointType.e_ropeJoint);goog.exportProperty(box2d.b2JointType,"e_motorJoint",box2d.b2JointType.e_motorJoint);goog.exportProperty(box2d.b2JointType,"e_areaJoint",box2d.b2JointType.e_areaJoint);box2d.b2LimitState={e_inactiveLimit:0,e_atLowerLimit:1,e_atUpperLimit:2,e_equalLimits:3};
goog.exportSymbol("box2d.b2LimitState",box2d.b2LimitState);goog.exportProperty(box2d.b2LimitState,"e_inactiveLimit",box2d.b2LimitState.e_inactiveLimit);goog.exportProperty(box2d.b2LimitState,"e_atLowerLimit",box2d.b2LimitState.e_atLowerLimit);goog.exportProperty(box2d.b2LimitState,"e_atUpperLimit",box2d.b2LimitState.e_atUpperLimit);goog.exportProperty(box2d.b2LimitState,"e_equalLimits",box2d.b2LimitState.e_equalLimits);box2d.b2Jacobian=function(){this.linear=new box2d.b2Vec2};
goog.exportSymbol("box2d.b2Jacobian",box2d.b2Jacobian);box2d.b2Jacobian.prototype.linear=null;goog.exportProperty(box2d.b2Jacobian.prototype,"linear",box2d.b2Jacobian.prototype.linear);box2d.b2Jacobian.prototype.angularA=0;goog.exportProperty(box2d.b2Jacobian.prototype,"angularA",box2d.b2Jacobian.prototype.angularA);box2d.b2Jacobian.prototype.angularB=0;goog.exportProperty(box2d.b2Jacobian.prototype,"angularB",box2d.b2Jacobian.prototype.angularB);
box2d.b2Jacobian.prototype.SetZero=function(){this.linear.SetZero();this.angularB=this.angularA=0;return this};goog.exportProperty(box2d.b2Jacobian.prototype,"SetZero",box2d.b2Jacobian.prototype.SetZero);box2d.b2Jacobian.prototype.Set=function(a,b,c){this.linear.Copy(a);this.angularA=b;this.angularB=c;return this};goog.exportProperty(box2d.b2Jacobian.prototype,"Set",box2d.b2Jacobian.prototype.Set);box2d.b2JointEdge=function(){};goog.exportSymbol("box2d.b2JointEdge",box2d.b2JointEdge);
box2d.b2JointEdge.prototype.other=null;goog.exportProperty(box2d.b2JointEdge.prototype,"other",box2d.b2JointEdge.prototype.other);box2d.b2JointEdge.prototype.joint=null;goog.exportProperty(box2d.b2JointEdge.prototype,"joint",box2d.b2JointEdge.prototype.joint);box2d.b2JointEdge.prototype.prev=null;goog.exportProperty(box2d.b2JointEdge.prototype,"prev",box2d.b2JointEdge.prototype.prev);box2d.b2JointEdge.prototype.next=null;goog.exportProperty(box2d.b2JointEdge.prototype,"next",box2d.b2JointEdge.prototype.next);
box2d.b2JointDef=function(a){this.type=a};goog.exportSymbol("box2d.b2JointDef",box2d.b2JointDef);box2d.b2JointDef.prototype.type=box2d.b2JointType.e_unknownJoint;goog.exportProperty(box2d.b2JointDef.prototype,"type",box2d.b2JointDef.prototype.type);box2d.b2JointDef.prototype.userData=null;goog.exportProperty(box2d.b2JointDef.prototype,"userData",box2d.b2JointDef.prototype.userData);box2d.b2JointDef.prototype.bodyA=null;goog.exportProperty(box2d.b2JointDef.prototype,"bodyA",box2d.b2JointDef.prototype.bodyA);
box2d.b2JointDef.prototype.bodyB=null;goog.exportProperty(box2d.b2JointDef.prototype,"bodyB",box2d.b2JointDef.prototype.bodyB);box2d.b2JointDef.prototype.collideConnected=!1;goog.exportProperty(box2d.b2JointDef.prototype,"collideConnected",box2d.b2JointDef.prototype.collideConnected);
box2d.b2Joint=function(a){box2d.ENABLE_ASSERTS&&box2d.b2Assert(a.bodyA!==a.bodyB);this.m_type=a.type;this.m_edgeA=new box2d.b2JointEdge;this.m_edgeB=new box2d.b2JointEdge;this.m_bodyA=a.bodyA;this.m_bodyB=a.bodyB;this.m_collideConnected=a.collideConnected;this.m_userData=a.userData};goog.exportSymbol("box2d.b2Joint",box2d.b2Joint);box2d.b2Joint.prototype.m_type=box2d.b2JointType.e_unknownJoint;goog.exportProperty(box2d.b2Joint.prototype,"m_type",box2d.b2Joint.prototype.m_type);
box2d.b2Joint.prototype.m_prev=null;goog.exportProperty(box2d.b2Joint.prototype,"m_prev",box2d.b2Joint.prototype.m_prev);box2d.b2Joint.prototype.m_next=null;goog.exportProperty(box2d.b2Joint.prototype,"m_next",box2d.b2Joint.prototype.m_next);box2d.b2Joint.prototype.m_edgeA=null;goog.exportProperty(box2d.b2Joint.prototype,"m_edgeA",box2d.b2Joint.prototype.m_edgeA);box2d.b2Joint.prototype.m_edgeB=null;goog.exportProperty(box2d.b2Joint.prototype,"m_edgeB",box2d.b2Joint.prototype.m_edgeB);
box2d.b2Joint.prototype.m_bodyA=null;goog.exportProperty(box2d.b2Joint.prototype,"m_bodyA",box2d.b2Joint.prototype.m_bodyA);box2d.b2Joint.prototype.m_bodyB=null;goog.exportProperty(box2d.b2Joint.prototype,"m_bodyB",box2d.b2Joint.prototype.m_bodyB);box2d.b2Joint.prototype.m_index=0;goog.exportProperty(box2d.b2Joint.prototype,"m_index",box2d.b2Joint.prototype.m_index);box2d.b2Joint.prototype.m_islandFlag=!1;goog.exportProperty(box2d.b2Joint.prototype,"m_islandFlag",box2d.b2Joint.prototype.m_islandFlag);
box2d.b2Joint.prototype.m_collideConnected=!1;goog.exportProperty(box2d.b2Joint.prototype,"m_collideConnected",box2d.b2Joint.prototype.m_collideConnected);box2d.b2Joint.prototype.m_userData=null;goog.exportProperty(box2d.b2Joint.prototype,"m_userData",box2d.b2Joint.prototype.m_userData);box2d.b2Joint.prototype.GetAnchorA=function(a){return a.SetZero()};goog.exportProperty(box2d.b2Joint.prototype,"GetAnchorA",box2d.b2Joint.prototype.GetAnchorA);box2d.b2Joint.prototype.GetAnchorB=function(a){return a.SetZero()};
goog.exportProperty(box2d.b2Joint.prototype,"GetAnchorB",box2d.b2Joint.prototype.GetAnchorB);box2d.b2Joint.prototype.GetReactionForce=function(a,b){return b.SetZero()};goog.exportProperty(box2d.b2Joint.prototype,"GetReactionForce",box2d.b2Joint.prototype.GetReactionForce);box2d.b2Joint.prototype.GetReactionTorque=function(a){return 0};goog.exportProperty(box2d.b2Joint.prototype,"GetReactionTorque",box2d.b2Joint.prototype.GetReactionTorque);box2d.b2Joint.prototype.InitVelocityConstraints=function(a){};
goog.exportProperty(box2d.b2Joint.prototype,"InitVelocityConstraints",box2d.b2Joint.prototype.InitVelocityConstraints);box2d.b2Joint.prototype.SolveVelocityConstraints=function(a){};goog.exportProperty(box2d.b2Joint.prototype,"SolveVelocityConstraints",box2d.b2Joint.prototype.SolveVelocityConstraints);box2d.b2Joint.prototype.SolvePositionConstraints=function(a){return!1};goog.exportProperty(box2d.b2Joint.prototype,"SolvePositionConstraints",box2d.b2Joint.prototype.SolvePositionConstraints);
box2d.b2Joint.prototype.GetType=function(){return this.m_type};goog.exportProperty(box2d.b2Joint.prototype,"GetType",box2d.b2Joint.prototype.GetType);box2d.b2Joint.prototype.GetBodyA=function(){return this.m_bodyA};goog.exportProperty(box2d.b2Joint.prototype,"GetBodyA",box2d.b2Joint.prototype.GetBodyA);box2d.b2Joint.prototype.GetBodyB=function(){return this.m_bodyB};goog.exportProperty(box2d.b2Joint.prototype,"GetBodyB",box2d.b2Joint.prototype.GetBodyB);box2d.b2Joint.prototype.GetNext=function(){return this.m_next};
goog.exportProperty(box2d.b2Joint.prototype,"GetNext",box2d.b2Joint.prototype.GetNext);box2d.b2Joint.prototype.GetUserData=function(){return this.m_userData};goog.exportProperty(box2d.b2Joint.prototype,"GetUserData",box2d.b2Joint.prototype.GetUserData);box2d.b2Joint.prototype.SetUserData=function(a){this.m_userData=a};goog.exportProperty(box2d.b2Joint.prototype,"SetUserData",box2d.b2Joint.prototype.SetUserData);box2d.b2Joint.prototype.GetCollideConnected=function(){return this.m_collideConnected};
goog.exportProperty(box2d.b2Joint.prototype,"GetCollideConnected",box2d.b2Joint.prototype.GetCollideConnected);box2d.b2Joint.prototype.Dump=function(){box2d.DEBUG&&box2d.b2Log("// Dump is not supported for this joint type.\n")};goog.exportProperty(box2d.b2Joint.prototype,"Dump",box2d.b2Joint.prototype.Dump);box2d.b2Joint.prototype.IsActive=function(){return this.m_bodyA.IsActive()&&this.m_bodyB.IsActive()};goog.exportProperty(box2d.b2Joint.prototype,"IsActive",box2d.b2Joint.prototype.IsActive);
box2d.b2Joint.prototype.ShiftOrigin=function(a){};goog.exportProperty(box2d.b2Joint.prototype,"ShiftOrigin",box2d.b2Joint.prototype.ShiftOrigin);box2d.b2RevoluteJointDef=function(){box2d.b2JointDef.call(this,box2d.b2JointType.e_revoluteJoint);this.localAnchorA=new box2d.b2Vec2(0,0);this.localAnchorB=new box2d.b2Vec2(0,0)};goog.inherits(box2d.b2RevoluteJointDef,box2d.b2JointDef);goog.exportSymbol("box2d.b2RevoluteJointDef",box2d.b2RevoluteJointDef);box2d.b2RevoluteJointDef.prototype.localAnchorA=null;goog.exportProperty(box2d.b2RevoluteJointDef.prototype,"localAnchorA",box2d.b2RevoluteJointDef.prototype.localAnchorA);
box2d.b2RevoluteJointDef.prototype.localAnchorB=null;goog.exportProperty(box2d.b2RevoluteJointDef.prototype,"localAnchorB",box2d.b2RevoluteJointDef.prototype.localAnchorB);box2d.b2RevoluteJointDef.prototype.referenceAngle=0;goog.exportProperty(box2d.b2RevoluteJointDef.prototype,"referenceAngle",box2d.b2RevoluteJointDef.prototype.referenceAngle);box2d.b2RevoluteJointDef.prototype.enableLimit=!1;goog.exportProperty(box2d.b2RevoluteJointDef.prototype,"enableLimit",box2d.b2RevoluteJointDef.prototype.enableLimit);
box2d.b2RevoluteJointDef.prototype.lowerAngle=0;goog.exportProperty(box2d.b2RevoluteJointDef.prototype,"lowerAngle",box2d.b2RevoluteJointDef.prototype.lowerAngle);box2d.b2RevoluteJointDef.prototype.upperAngle=0;goog.exportProperty(box2d.b2RevoluteJointDef.prototype,"upperAngle",box2d.b2RevoluteJointDef.prototype.upperAngle);box2d.b2RevoluteJointDef.prototype.enableMotor=!1;goog.exportProperty(box2d.b2RevoluteJointDef.prototype,"enableMotor",box2d.b2RevoluteJointDef.prototype.enableMotor);
box2d.b2RevoluteJointDef.prototype.motorSpeed=0;goog.exportProperty(box2d.b2RevoluteJointDef.prototype,"motorSpeed",box2d.b2RevoluteJointDef.prototype.motorSpeed);box2d.b2RevoluteJointDef.prototype.maxMotorTorque=0;goog.exportProperty(box2d.b2RevoluteJointDef.prototype,"maxMotorTorque",box2d.b2RevoluteJointDef.prototype.maxMotorTorque);
box2d.b2RevoluteJointDef.prototype.Initialize=function(a,b,c){this.bodyA=a;this.bodyB=b;this.bodyA.GetLocalPoint(c,this.localAnchorA);this.bodyB.GetLocalPoint(c,this.localAnchorB);this.referenceAngle=this.bodyB.GetAngleRadians()-this.bodyA.GetAngleRadians()};goog.exportProperty(box2d.b2RevoluteJointDef.prototype,"Initialize",box2d.b2RevoluteJointDef.prototype.Initialize);
box2d.b2RevoluteJoint=function(a){box2d.b2Joint.call(this,a);this.m_localAnchorA=new box2d.b2Vec2;this.m_localAnchorB=new box2d.b2Vec2;this.m_impulse=new box2d.b2Vec3;this.m_rA=new box2d.b2Vec2;this.m_rB=new box2d.b2Vec2;this.m_localCenterA=new box2d.b2Vec2;this.m_localCenterB=new box2d.b2Vec2;this.m_mass=new box2d.b2Mat33;this.m_qA=new box2d.b2Rot;this.m_qB=new box2d.b2Rot;this.m_lalcA=new box2d.b2Vec2;this.m_lalcB=new box2d.b2Vec2;this.m_K=new box2d.b2Mat22;this.m_localAnchorA.Copy(a.localAnchorA);
this.m_localAnchorB.Copy(a.localAnchorB);this.m_referenceAngle=a.referenceAngle;this.m_impulse.SetZero();this.m_motorImpulse=0;this.m_lowerAngle=a.lowerAngle;this.m_upperAngle=a.upperAngle;this.m_maxMotorTorque=a.maxMotorTorque;this.m_motorSpeed=a.motorSpeed;this.m_enableLimit=a.enableLimit;this.m_enableMotor=a.enableMotor;this.m_limitState=box2d.b2LimitState.e_inactiveLimit};goog.inherits(box2d.b2RevoluteJoint,box2d.b2Joint);goog.exportSymbol("box2d.b2RevoluteJoint",box2d.b2RevoluteJoint);
box2d.b2RevoluteJoint.prototype.m_localAnchorA=null;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_localAnchorA",box2d.b2RevoluteJoint.prototype.m_localAnchorA);box2d.b2RevoluteJoint.prototype.m_localAnchorB=null;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_localAnchorB",box2d.b2RevoluteJoint.prototype.m_localAnchorB);box2d.b2RevoluteJoint.prototype.m_impulse=null;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_impulse",box2d.b2RevoluteJoint.prototype.m_impulse);
box2d.b2RevoluteJoint.prototype.m_motorImpulse=0;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_motorImpulse",box2d.b2RevoluteJoint.prototype.m_motorImpulse);box2d.b2RevoluteJoint.prototype.m_enableMotor=!1;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_enableMotor",box2d.b2RevoluteJoint.prototype.m_enableMotor);box2d.b2RevoluteJoint.prototype.m_maxMotorTorque=0;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_maxMotorTorque",box2d.b2RevoluteJoint.prototype.m_maxMotorTorque);
box2d.b2RevoluteJoint.prototype.m_motorSpeed=0;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_motorSpeed",box2d.b2RevoluteJoint.prototype.m_motorSpeed);box2d.b2RevoluteJoint.prototype.m_enableLimit=!1;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_enableLimit",box2d.b2RevoluteJoint.prototype.m_enableLimit);box2d.b2RevoluteJoint.prototype.m_referenceAngle=0;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_referenceAngle",box2d.b2RevoluteJoint.prototype.m_referenceAngle);
box2d.b2RevoluteJoint.prototype.m_lowerAngle=0;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_lowerAngle",box2d.b2RevoluteJoint.prototype.m_lowerAngle);box2d.b2RevoluteJoint.prototype.m_upperAngle=0;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_upperAngle",box2d.b2RevoluteJoint.prototype.m_upperAngle);box2d.b2RevoluteJoint.prototype.m_indexA=0;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_indexA",box2d.b2RevoluteJoint.prototype.m_indexA);
box2d.b2RevoluteJoint.prototype.m_indexB=0;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_indexB",box2d.b2RevoluteJoint.prototype.m_indexB);box2d.b2RevoluteJoint.prototype.m_rA=null;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_rA",box2d.b2RevoluteJoint.prototype.m_rA);box2d.b2RevoluteJoint.prototype.m_rB=null;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_rB",box2d.b2RevoluteJoint.prototype.m_rB);box2d.b2RevoluteJoint.prototype.m_localCenterA=null;
goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_localCenterA",box2d.b2RevoluteJoint.prototype.m_localCenterA);box2d.b2RevoluteJoint.prototype.m_localCenterB=null;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_localCenterB",box2d.b2RevoluteJoint.prototype.m_localCenterB);box2d.b2RevoluteJoint.prototype.m_invMassA=0;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_invMassA",box2d.b2RevoluteJoint.prototype.m_invMassA);box2d.b2RevoluteJoint.prototype.m_invMassB=0;
goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_invMassB",box2d.b2RevoluteJoint.prototype.m_invMassB);box2d.b2RevoluteJoint.prototype.m_invIA=0;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_invIA",box2d.b2RevoluteJoint.prototype.m_invIA);box2d.b2RevoluteJoint.prototype.m_invIB=0;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_invIB",box2d.b2RevoluteJoint.prototype.m_invIB);box2d.b2RevoluteJoint.prototype.m_mass=null;
goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_mass",box2d.b2RevoluteJoint.prototype.m_mass);box2d.b2RevoluteJoint.prototype.m_motorMass=0;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_motorMass",box2d.b2RevoluteJoint.prototype.m_motorMass);box2d.b2RevoluteJoint.prototype.m_limitState=box2d.b2LimitState.e_inactiveLimit;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_limitState",box2d.b2RevoluteJoint.prototype.m_limitState);box2d.b2RevoluteJoint.prototype.m_qA=null;
goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_qA",box2d.b2RevoluteJoint.prototype.m_qA);box2d.b2RevoluteJoint.prototype.m_qB=null;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_qB",box2d.b2RevoluteJoint.prototype.m_qB);box2d.b2RevoluteJoint.prototype.m_lalcA=null;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_lalcA",box2d.b2RevoluteJoint.prototype.m_lalcA);box2d.b2RevoluteJoint.prototype.m_lalcB=null;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_lalcB",box2d.b2RevoluteJoint.prototype.m_lalcB);
box2d.b2RevoluteJoint.prototype.m_K=null;goog.exportProperty(box2d.b2RevoluteJoint.prototype,"m_K",box2d.b2RevoluteJoint.prototype.m_K);
box2d.b2RevoluteJoint.prototype.InitVelocityConstraints=function(a){this.m_indexA=this.m_bodyA.m_islandIndex;this.m_indexB=this.m_bodyB.m_islandIndex;this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);this.m_invMassA=this.m_bodyA.m_invMass;this.m_invMassB=this.m_bodyB.m_invMass;this.m_invIA=this.m_bodyA.m_invI;this.m_invIB=this.m_bodyB.m_invI;var b=a.positions[this.m_indexA].a,c=a.velocities[this.m_indexA].v,e=a.velocities[this.m_indexA].w,
d=a.positions[this.m_indexB].a,f=a.velocities[this.m_indexB].v,g=a.velocities[this.m_indexB].w,h=this.m_qA.SetAngleRadians(b),l=this.m_qB.SetAngleRadians(d);box2d.b2SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);box2d.b2MulRV(h,this.m_lalcA,this.m_rA);box2d.b2SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);box2d.b2MulRV(l,this.m_lalcB,this.m_rB);var h=this.m_invMassA,l=this.m_invMassB,k=this.m_invIA,m=this.m_invIB,n=0===k+m;this.m_mass.ex.x=h+l+this.m_rA.y*this.m_rA.y*k+this.m_rB.y*
this.m_rB.y*m;this.m_mass.ey.x=-this.m_rA.y*this.m_rA.x*k-this.m_rB.y*this.m_rB.x*m;this.m_mass.ez.x=-this.m_rA.y*k-this.m_rB.y*m;this.m_mass.ex.y=this.m_mass.ey.x;this.m_mass.ey.y=h+l+this.m_rA.x*this.m_rA.x*k+this.m_rB.x*this.m_rB.x*m;this.m_mass.ez.y=this.m_rA.x*k+this.m_rB.x*m;this.m_mass.ex.z=this.m_mass.ez.x;this.m_mass.ey.z=this.m_mass.ez.y;this.m_mass.ez.z=k+m;this.m_motorMass=k+m;0<this.m_motorMass&&(this.m_motorMass=1/this.m_motorMass);if(!1===this.m_enableMotor||n)this.m_motorImpulse=0;
this.m_enableLimit&&!1===n?(b=d-b-this.m_referenceAngle,box2d.b2Abs(this.m_upperAngle-this.m_lowerAngle)<2*box2d.b2_angularSlop?this.m_limitState=box2d.b2LimitState.e_equalLimits:b<=this.m_lowerAngle?(this.m_limitState!==box2d.b2LimitState.e_atLowerLimit&&(this.m_impulse.z=0),this.m_limitState=box2d.b2LimitState.e_atLowerLimit):b>=this.m_upperAngle?(this.m_limitState!==box2d.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=0),this.m_limitState=box2d.b2LimitState.e_atUpperLimit):(this.m_limitState=box2d.b2LimitState.e_inactiveLimit,
this.m_impulse.z=0)):this.m_limitState=box2d.b2LimitState.e_inactiveLimit;a.step.warmStarting?(this.m_impulse.SelfMul(a.step.dtRatio),this.m_motorImpulse*=a.step.dtRatio,b=box2d.b2RevoluteJoint.prototype.InitVelocityConstraints.s_P.SetXY(this.m_impulse.x,this.m_impulse.y),c.SelfMulSub(h,b),e-=k*(box2d.b2CrossVV(this.m_rA,b)+this.m_motorImpulse+this.m_impulse.z),f.SelfMulAdd(l,b),g+=m*(box2d.b2CrossVV(this.m_rB,b)+this.m_motorImpulse+this.m_impulse.z)):(this.m_impulse.SetZero(),this.m_motorImpulse=
0);a.velocities[this.m_indexA].w=e;a.velocities[this.m_indexB].w=g};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"InitVelocityConstraints",box2d.b2RevoluteJoint.prototype.InitVelocityConstraints);box2d.b2RevoluteJoint.prototype.InitVelocityConstraints.s_P=new box2d.b2Vec2;
box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints=function(a){var b=a.velocities[this.m_indexA].v,c=a.velocities[this.m_indexA].w,e=a.velocities[this.m_indexB].v,d=a.velocities[this.m_indexB].w,f=this.m_invMassA,g=this.m_invMassB,h=this.m_invIA,l=this.m_invIB,k=0===h+l;if(this.m_enableMotor&&this.m_limitState!==box2d.b2LimitState.e_equalLimits&&!1===k){var m=d-c-this.m_motorSpeed,m=-this.m_motorMass*m,n=this.m_motorImpulse,p=a.step.dt*this.m_maxMotorTorque;this.m_motorImpulse=box2d.b2Clamp(this.m_motorImpulse+
m,-p,p);m=this.m_motorImpulse-n;c-=h*m;d+=l*m}this.m_enableLimit&&this.m_limitState!==box2d.b2LimitState.e_inactiveLimit&&!1===k?(k=box2d.b2SubVV(box2d.b2AddVCrossSV(e,d,this.m_rB,box2d.b2Vec2.s_t0),box2d.b2AddVCrossSV(b,c,this.m_rA,box2d.b2Vec2.s_t1),box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_Cdot1),m=this.m_mass.Solve33(k.x,k.y,d-c,box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_impulse3).SelfNeg(),this.m_limitState===box2d.b2LimitState.e_equalLimits?this.m_impulse.SelfAdd(m):
this.m_limitState===box2d.b2LimitState.e_atLowerLimit?(n=this.m_impulse.z+m.z,0>n?(n=-k.x+this.m_impulse.z*this.m_mass.ez.x,k=-k.y+this.m_impulse.z*this.m_mass.ez.y,k=this.m_mass.Solve22(n,k,box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_reduced),m.x=k.x,m.y=k.y,m.z=-this.m_impulse.z,this.m_impulse.x+=k.x,this.m_impulse.y+=k.y,this.m_impulse.z=0):this.m_impulse.SelfAdd(m)):this.m_limitState===box2d.b2LimitState.e_atUpperLimit&&(n=this.m_impulse.z+m.z,0<n?(n=-k.x+this.m_impulse.z*this.m_mass.ez.x,
k=-k.y+this.m_impulse.z*this.m_mass.ez.y,k=this.m_mass.Solve22(n,k,box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_reduced),m.x=k.x,m.y=k.y,m.z=-this.m_impulse.z,this.m_impulse.x+=k.x,this.m_impulse.y+=k.y,this.m_impulse.z=0):this.m_impulse.SelfAdd(m)),k=box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_P.SetXY(m.x,m.y),b.SelfMulSub(f,k),c-=h*(box2d.b2CrossVV(this.m_rA,k)+m.z),e.SelfMulAdd(g,k),d+=l*(box2d.b2CrossVV(this.m_rB,k)+m.z)):(m=box2d.b2SubVV(box2d.b2AddVCrossSV(e,d,this.m_rB,
box2d.b2Vec2.s_t0),box2d.b2AddVCrossSV(b,c,this.m_rA,box2d.b2Vec2.s_t1),box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_Cdot),m=this.m_mass.Solve22(-m.x,-m.y,box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_impulse2),this.m_impulse.x+=m.x,this.m_impulse.y+=m.y,b.SelfMulSub(f,m),c-=h*box2d.b2CrossVV(this.m_rA,m),e.SelfMulAdd(g,m),d+=l*box2d.b2CrossVV(this.m_rB,m));a.velocities[this.m_indexA].w=c;a.velocities[this.m_indexB].w=d};
goog.exportProperty(box2d.b2RevoluteJoint.prototype,"SolveVelocityConstraints",box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints);box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_P=new box2d.b2Vec2;box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_Cdot=new box2d.b2Vec2;box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_Cdot1=new box2d.b2Vec2;box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_impulse3=new box2d.b2Vec3;
box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_reduced=new box2d.b2Vec2;box2d.b2RevoluteJoint.prototype.SolveVelocityConstraints.s_impulse2=new box2d.b2Vec2;
box2d.b2RevoluteJoint.prototype.SolvePositionConstraints=function(a){var b=a.positions[this.m_indexA].c,c=a.positions[this.m_indexA].a,e=a.positions[this.m_indexB].c,d=a.positions[this.m_indexB].a,f=this.m_qA.SetAngleRadians(c),g=this.m_qB.SetAngleRadians(d),h=0,l=0,l=0===this.m_invIA+this.m_invIB;if(this.m_enableLimit&&this.m_limitState!==box2d.b2LimitState.e_inactiveLimit&&!1===l){var k=d-c-this.m_referenceAngle,l=0;this.m_limitState===box2d.b2LimitState.e_equalLimits?(k=box2d.b2Clamp(k-this.m_lowerAngle,
-box2d.b2_maxAngularCorrection,box2d.b2_maxAngularCorrection),l=-this.m_motorMass*k,h=box2d.b2Abs(k)):this.m_limitState===box2d.b2LimitState.e_atLowerLimit?(k-=this.m_lowerAngle,h=-k,k=box2d.b2Clamp(k+box2d.b2_angularSlop,-box2d.b2_maxAngularCorrection,0),l=-this.m_motorMass*k):this.m_limitState===box2d.b2LimitState.e_atUpperLimit&&(h=k-=this.m_upperAngle,k=box2d.b2Clamp(k-box2d.b2_angularSlop,0,box2d.b2_maxAngularCorrection),l=-this.m_motorMass*k);c-=this.m_invIA*l;d+=this.m_invIB*l}f.SetAngleRadians(c);
g.SetAngleRadians(d);box2d.b2SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);f=box2d.b2MulRV(f,this.m_lalcA,this.m_rA);box2d.b2SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var g=box2d.b2MulRV(g,this.m_lalcB,this.m_rB),k=box2d.b2SubVV(box2d.b2AddVV(e,g,box2d.b2Vec2.s_t0),box2d.b2AddVV(b,f,box2d.b2Vec2.s_t1),box2d.b2RevoluteJoint.prototype.SolvePositionConstraints.s_C),l=k.GetLength(),m=this.m_invMassA,n=this.m_invMassB,p=this.m_invIA,q=this.m_invIB,r=this.m_K;r.ex.x=m+n+
p*f.y*f.y+q*g.y*g.y;r.ex.y=-p*f.x*f.y-q*g.x*g.y;r.ey.x=r.ex.y;r.ey.y=m+n+p*f.x*f.x+q*g.x*g.x;k=r.Solve(k.x,k.y,box2d.b2RevoluteJoint.prototype.SolvePositionConstraints.s_impulse).SelfNeg();b.SelfMulSub(m,k);c-=p*box2d.b2CrossVV(f,k);e.SelfMulAdd(n,k);d+=q*box2d.b2CrossVV(g,k);a.positions[this.m_indexA].a=c;a.positions[this.m_indexB].a=d;return l<=box2d.b2_linearSlop&&h<=box2d.b2_angularSlop};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"SolvePositionConstraints",box2d.b2RevoluteJoint.prototype.SolvePositionConstraints);
box2d.b2RevoluteJoint.prototype.SolvePositionConstraints.s_C=new box2d.b2Vec2;box2d.b2RevoluteJoint.prototype.SolvePositionConstraints.s_impulse=new box2d.b2Vec2;box2d.b2RevoluteJoint.prototype.GetAnchorA=function(a){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,a)};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetAnchorA",box2d.b2RevoluteJoint.prototype.GetAnchorA);box2d.b2RevoluteJoint.prototype.GetAnchorB=function(a){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,a)};
goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetAnchorB",box2d.b2RevoluteJoint.prototype.GetAnchorB);box2d.b2RevoluteJoint.prototype.GetReactionForce=function(a,b){return b.SetXY(a*this.m_impulse.x,a*this.m_impulse.y)};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetReactionForce",box2d.b2RevoluteJoint.prototype.GetReactionForce);box2d.b2RevoluteJoint.prototype.GetReactionTorque=function(a){return a*this.m_impulse.z};
goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetReactionTorque",box2d.b2RevoluteJoint.prototype.GetReactionTorque);box2d.b2RevoluteJoint.prototype.GetLocalAnchorA=function(a){return a.Copy(this.m_localAnchorA)};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetLocalAnchorA",box2d.b2RevoluteJoint.prototype.GetLocalAnchorA);box2d.b2RevoluteJoint.prototype.GetLocalAnchorB=function(a){return a.Copy(this.m_localAnchorB)};
goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetLocalAnchorB",box2d.b2RevoluteJoint.prototype.GetLocalAnchorB);box2d.b2RevoluteJoint.prototype.GetReferenceAngle=function(){return this.m_referenceAngle};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetReferenceAngle",box2d.b2RevoluteJoint.prototype.GetReferenceAngle);box2d.b2RevoluteJoint.prototype.GetJointAngleRadians=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a-this.m_referenceAngle};
goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetJointAngleRadians",box2d.b2RevoluteJoint.prototype.GetJointAngleRadians);box2d.b2RevoluteJoint.prototype.GetJointSpeed=function(){return this.m_bodyB.m_angularVelocity-this.m_bodyA.m_angularVelocity};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetJointSpeed",box2d.b2RevoluteJoint.prototype.GetJointSpeed);box2d.b2RevoluteJoint.prototype.IsMotorEnabled=function(){return this.m_enableMotor};
goog.exportProperty(box2d.b2RevoluteJoint.prototype,"IsMotorEnabled",box2d.b2RevoluteJoint.prototype.IsMotorEnabled);box2d.b2RevoluteJoint.prototype.EnableMotor=function(a){this.m_enableMotor!==a&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=a)};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"EnableMotor",box2d.b2RevoluteJoint.prototype.EnableMotor);box2d.b2RevoluteJoint.prototype.GetMotorTorque=function(a){return a*this.m_motorImpulse};
goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetMotorTorque",box2d.b2RevoluteJoint.prototype.GetMotorTorque);box2d.b2RevoluteJoint.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetMotorSpeed",box2d.b2RevoluteJoint.prototype.GetMotorSpeed);box2d.b2RevoluteJoint.prototype.SetMaxMotorTorque=function(a){this.m_maxMotorTorque=a};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"SetMaxMotorTorque",box2d.b2RevoluteJoint.prototype.SetMaxMotorTorque);
box2d.b2RevoluteJoint.prototype.GetMaxMotorTorque=function(){return this.m_maxMotorTorque};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetMaxMotorTorque",box2d.b2RevoluteJoint.prototype.GetMaxMotorTorque);box2d.b2RevoluteJoint.prototype.IsLimitEnabled=function(){return this.m_enableLimit};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"IsLimitEnabled",box2d.b2RevoluteJoint.prototype.IsLimitEnabled);
box2d.b2RevoluteJoint.prototype.EnableLimit=function(a){a!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=a,this.m_impulse.z=0)};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"EnableLimit",box2d.b2RevoluteJoint.prototype.EnableLimit);box2d.b2RevoluteJoint.prototype.GetLowerLimit=function(){return this.m_lowerAngle};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetLowerLimit",box2d.b2RevoluteJoint.prototype.GetLowerLimit);
box2d.b2RevoluteJoint.prototype.GetUpperLimit=function(){return this.m_upperAngle};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"GetUpperLimit",box2d.b2RevoluteJoint.prototype.GetUpperLimit);box2d.b2RevoluteJoint.prototype.SetLimits=function(a,b){if(a!==this.m_lowerAngle||b!==this.m_upperAngle)this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_impulse.z=0,this.m_lowerAngle=a,this.m_upperAngle=b};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"SetLimits",box2d.b2RevoluteJoint.prototype.SetLimits);
box2d.b2RevoluteJoint.prototype.SetMotorSpeed=function(a){this.m_motorSpeed!==a&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=a)};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"SetMotorSpeed",box2d.b2RevoluteJoint.prototype.SetMotorSpeed);
box2d.b2RevoluteJoint.prototype.Dump=function(){if(box2d.DEBUG){var a=this.m_bodyA.m_islandIndex,b=this.m_bodyB.m_islandIndex;box2d.b2Log("  /*box2d.b2RevoluteJointDef*/ var jd = new box2d.b2RevoluteJointDef();\n");box2d.b2Log("  jd.bodyA = bodies[%d];\n",a);box2d.b2Log("  jd.bodyB = bodies[%d];\n",b);box2d.b2Log("  jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false");box2d.b2Log("  jd.localAnchorA.SetXY(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y);box2d.b2Log("  jd.localAnchorB.SetXY(%.15f, %.15f);\n",
this.m_localAnchorB.x,this.m_localAnchorB.y);box2d.b2Log("  jd.referenceAngle = %.15f;\n",this.m_referenceAngle);box2d.b2Log("  jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false");box2d.b2Log("  jd.lowerAngle = %.15f;\n",this.m_lowerAngle);box2d.b2Log("  jd.upperAngle = %.15f;\n",this.m_upperAngle);box2d.b2Log("  jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false");box2d.b2Log("  jd.motorSpeed = %.15f;\n",this.m_motorSpeed);box2d.b2Log("  jd.maxMotorTorque = %.15f;\n",this.m_maxMotorTorque);
box2d.b2Log("  joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)}};goog.exportProperty(box2d.b2RevoluteJoint.prototype,"Dump",box2d.b2RevoluteJoint.prototype.Dump);box2d.b2PrismaticJointDef=function(){box2d.b2JointDef.call(this,box2d.b2JointType.e_prismaticJoint);this.localAnchorA=new box2d.b2Vec2;this.localAnchorB=new box2d.b2Vec2;this.localAxisA=new box2d.b2Vec2(1,0)};goog.inherits(box2d.b2PrismaticJointDef,box2d.b2JointDef);goog.exportSymbol("box2d.b2PrismaticJointDef",box2d.b2PrismaticJointDef);box2d.b2PrismaticJointDef.prototype.localAnchorA=null;goog.exportProperty(box2d.b2PrismaticJointDef.prototype,"localAnchorA",box2d.b2PrismaticJointDef.prototype.localAnchorA);
box2d.b2PrismaticJointDef.prototype.localAnchorB=null;goog.exportProperty(box2d.b2PrismaticJointDef.prototype,"localAnchorB",box2d.b2PrismaticJointDef.prototype.localAnchorB);box2d.b2PrismaticJointDef.prototype.localAxisA=null;goog.exportProperty(box2d.b2PrismaticJointDef.prototype,"localAxisA",box2d.b2PrismaticJointDef.prototype.localAxisA);box2d.b2PrismaticJointDef.prototype.referenceAngle=0;goog.exportProperty(box2d.b2PrismaticJointDef.prototype,"referenceAngle",box2d.b2PrismaticJointDef.prototype.referenceAngle);
box2d.b2PrismaticJointDef.prototype.enableLimit=!1;goog.exportProperty(box2d.b2PrismaticJointDef.prototype,"enableLimit",box2d.b2PrismaticJointDef.prototype.enableLimit);box2d.b2PrismaticJointDef.prototype.lowerTranslation=0;goog.exportProperty(box2d.b2PrismaticJointDef.prototype,"lowerTranslation",box2d.b2PrismaticJointDef.prototype.lowerTranslation);box2d.b2PrismaticJointDef.prototype.upperTranslation=0;goog.exportProperty(box2d.b2PrismaticJointDef.prototype,"upperTranslation",box2d.b2PrismaticJointDef.prototype.upperTranslation);
box2d.b2PrismaticJointDef.prototype.enableMotor=!1;goog.exportProperty(box2d.b2PrismaticJointDef.prototype,"enableMotor",box2d.b2PrismaticJointDef.prototype.enableMotor);box2d.b2PrismaticJointDef.prototype.maxMotorForce=0;goog.exportProperty(box2d.b2PrismaticJointDef.prototype,"maxMotorForce",box2d.b2PrismaticJointDef.prototype.maxMotorForce);box2d.b2PrismaticJointDef.prototype.motorSpeed=0;goog.exportProperty(box2d.b2PrismaticJointDef.prototype,"motorSpeed",box2d.b2PrismaticJointDef.prototype.motorSpeed);
box2d.b2PrismaticJointDef.prototype.Initialize=function(a,b,c,e){this.bodyA=a;this.bodyB=b;this.bodyA.GetLocalPoint(c,this.localAnchorA);this.bodyB.GetLocalPoint(c,this.localAnchorB);this.bodyA.GetLocalVector(e,this.localAxisA);this.referenceAngle=this.bodyB.GetAngleRadians()-this.bodyA.GetAngleRadians()};goog.exportProperty(box2d.b2PrismaticJointDef.prototype,"Initialize",box2d.b2PrismaticJointDef.prototype.Initialize);
box2d.b2PrismaticJoint=function(a){box2d.b2Joint.call(this,a);this.m_localAnchorA=a.localAnchorA.Clone();this.m_localAnchorB=a.localAnchorB.Clone();this.m_localXAxisA=a.localAxisA.Clone().SelfNormalize();this.m_localYAxisA=box2d.b2CrossOneV(this.m_localXAxisA,new box2d.b2Vec2);this.m_referenceAngle=a.referenceAngle;this.m_impulse=new box2d.b2Vec3(0,0,0);this.m_lowerTranslation=a.lowerTranslation;this.m_upperTranslation=a.upperTranslation;this.m_maxMotorForce=a.maxMotorForce;this.m_motorSpeed=a.motorSpeed;
this.m_enableLimit=a.enableLimit;this.m_enableMotor=a.enableMotor;this.m_localCenterA=new box2d.b2Vec2;this.m_localCenterB=new box2d.b2Vec2;this.m_axis=new box2d.b2Vec2(0,0);this.m_perp=new box2d.b2Vec2(0,0);this.m_K=new box2d.b2Mat33;this.m_K3=new box2d.b2Mat33;this.m_K2=new box2d.b2Mat22;this.m_qA=new box2d.b2Rot;this.m_qB=new box2d.b2Rot;this.m_lalcA=new box2d.b2Vec2;this.m_lalcB=new box2d.b2Vec2;this.m_rA=new box2d.b2Vec2;this.m_rB=new box2d.b2Vec2};goog.inherits(box2d.b2PrismaticJoint,box2d.b2Joint);
goog.exportSymbol("box2d.b2PrismaticJoint",box2d.b2PrismaticJoint);box2d.b2PrismaticJoint.prototype.m_localAnchorA=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_localAnchorA",box2d.b2PrismaticJoint.prototype.m_localAnchorA);box2d.b2PrismaticJoint.prototype.m_localAnchorB=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_localAnchorB",box2d.b2PrismaticJoint.prototype.m_localAnchorB);box2d.b2PrismaticJoint.prototype.m_localXAxisA=null;
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_localXAxisA",box2d.b2PrismaticJoint.prototype.m_localXAxisA);box2d.b2PrismaticJoint.prototype.m_localYAxisA=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_localYAxisA",box2d.b2PrismaticJoint.prototype.m_localYAxisA);box2d.b2PrismaticJoint.prototype.m_referenceAngle=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_referenceAngle",box2d.b2PrismaticJoint.prototype.m_referenceAngle);
box2d.b2PrismaticJoint.prototype.m_impulse=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_impulse",box2d.b2PrismaticJoint.prototype.m_impulse);box2d.b2PrismaticJoint.prototype.m_motorImpulse=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_motorImpulse",box2d.b2PrismaticJoint.prototype.m_motorImpulse);box2d.b2PrismaticJoint.prototype.m_lowerTranslation=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_lowerTranslation",box2d.b2PrismaticJoint.prototype.m_lowerTranslation);
box2d.b2PrismaticJoint.prototype.m_upperTranslation=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_upperTranslation",box2d.b2PrismaticJoint.prototype.m_upperTranslation);box2d.b2PrismaticJoint.prototype.m_maxMotorForce=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_maxMotorForce",box2d.b2PrismaticJoint.prototype.m_maxMotorForce);box2d.b2PrismaticJoint.prototype.m_motorSpeed=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_motorSpeed",box2d.b2PrismaticJoint.prototype.m_motorSpeed);
box2d.b2PrismaticJoint.prototype.m_enableLimit=!1;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_enableLimit",box2d.b2PrismaticJoint.prototype.m_enableLimit);box2d.b2PrismaticJoint.prototype.m_enableMotor=!1;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_enableMotor",box2d.b2PrismaticJoint.prototype.m_enableMotor);box2d.b2PrismaticJoint.prototype.m_limitState=box2d.b2LimitState.e_inactiveLimit;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_limitState",box2d.b2PrismaticJoint.prototype.m_limitState);
box2d.b2PrismaticJoint.prototype.m_indexA=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_indexA",box2d.b2PrismaticJoint.prototype.m_indexA);box2d.b2PrismaticJoint.prototype.m_indexB=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_indexB",box2d.b2PrismaticJoint.prototype.m_indexB);box2d.b2PrismaticJoint.prototype.m_localCenterA=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_localCenterA",box2d.b2PrismaticJoint.prototype.m_localCenterA);
box2d.b2PrismaticJoint.prototype.m_localCenterB=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_localCenterB",box2d.b2PrismaticJoint.prototype.m_localCenterB);box2d.b2PrismaticJoint.prototype.m_invMassA=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_invMassA",box2d.b2PrismaticJoint.prototype.m_invMassA);box2d.b2PrismaticJoint.prototype.m_invMassB=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_invMassB",box2d.b2PrismaticJoint.prototype.m_invMassB);
box2d.b2PrismaticJoint.prototype.m_invIA=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_invIA",box2d.b2PrismaticJoint.prototype.m_invIA);box2d.b2PrismaticJoint.prototype.m_invIB=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_invIB",box2d.b2PrismaticJoint.prototype.m_invIB);box2d.b2PrismaticJoint.prototype.m_axis=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_axis",box2d.b2PrismaticJoint.prototype.m_axis);box2d.b2PrismaticJoint.prototype.m_perp=null;
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_perp",box2d.b2PrismaticJoint.prototype.m_perp);box2d.b2PrismaticJoint.prototype.m_s1=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_s1",box2d.b2PrismaticJoint.prototype.m_s1);box2d.b2PrismaticJoint.prototype.m_s2=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_s2",box2d.b2PrismaticJoint.prototype.m_s2);box2d.b2PrismaticJoint.prototype.m_a1=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_a1",box2d.b2PrismaticJoint.prototype.m_a1);
box2d.b2PrismaticJoint.prototype.m_a2=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_a2",box2d.b2PrismaticJoint.prototype.m_a2);box2d.b2PrismaticJoint.prototype.m_K=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_K",box2d.b2PrismaticJoint.prototype.m_K);box2d.b2PrismaticJoint.prototype.m_K3=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_K3",box2d.b2PrismaticJoint.prototype.m_K3);box2d.b2PrismaticJoint.prototype.m_K2=null;
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_K2",box2d.b2PrismaticJoint.prototype.m_K2);box2d.b2PrismaticJoint.prototype.m_motorMass=0;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_motorMass",box2d.b2PrismaticJoint.prototype.m_motorMass);box2d.b2PrismaticJoint.prototype.m_qA=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_qA",box2d.b2PrismaticJoint.prototype.m_qA);box2d.b2PrismaticJoint.prototype.m_qB=null;
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_qB",box2d.b2PrismaticJoint.prototype.m_qB);box2d.b2PrismaticJoint.prototype.m_lalcA=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_lalcA",box2d.b2PrismaticJoint.prototype.m_lalcA);box2d.b2PrismaticJoint.prototype.m_lalcB=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_lalcB",box2d.b2PrismaticJoint.prototype.m_lalcB);box2d.b2PrismaticJoint.prototype.m_rA=null;
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_rA",box2d.b2PrismaticJoint.prototype.m_rA);box2d.b2PrismaticJoint.prototype.m_rB=null;goog.exportProperty(box2d.b2PrismaticJoint.prototype,"m_rB",box2d.b2PrismaticJoint.prototype.m_rB);
box2d.b2PrismaticJoint.prototype.InitVelocityConstraints=function(a){this.m_indexA=this.m_bodyA.m_islandIndex;this.m_indexB=this.m_bodyB.m_islandIndex;this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);this.m_invMassA=this.m_bodyA.m_invMass;this.m_invMassB=this.m_bodyB.m_invMass;this.m_invIA=this.m_bodyA.m_invI;this.m_invIB=this.m_bodyB.m_invI;var b=a.positions[this.m_indexA].c,c=a.velocities[this.m_indexA].v,e=a.velocities[this.m_indexA].w,
d=a.positions[this.m_indexB].c,f=a.positions[this.m_indexB].a,g=a.velocities[this.m_indexB].v,h=a.velocities[this.m_indexB].w,l=this.m_qA.SetAngleRadians(a.positions[this.m_indexA].a),f=this.m_qB.SetAngleRadians(f);box2d.b2SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var k=box2d.b2MulRV(l,this.m_lalcA,this.m_rA);box2d.b2SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var m=box2d.b2MulRV(f,this.m_lalcB,this.m_rB),n=box2d.b2AddVV(box2d.b2SubVV(d,b,box2d.b2Vec2.s_t0),box2d.b2SubVV(m,
k,box2d.b2Vec2.s_t1),box2d.b2PrismaticJoint.prototype.InitVelocityConstraints.s_d),b=this.m_invMassA,d=this.m_invMassB,f=this.m_invIA,p=this.m_invIB;box2d.b2MulRV(l,this.m_localXAxisA,this.m_axis);this.m_a1=box2d.b2CrossVV(box2d.b2AddVV(n,k,box2d.b2Vec2.s_t0),this.m_axis);this.m_a2=box2d.b2CrossVV(m,this.m_axis);this.m_motorMass=b+d+f*this.m_a1*this.m_a1+p*this.m_a2*this.m_a2;0<this.m_motorMass&&(this.m_motorMass=1/this.m_motorMass);box2d.b2MulRV(l,this.m_localYAxisA,this.m_perp);this.m_s1=box2d.b2CrossVV(box2d.b2AddVV(n,
k,box2d.b2Vec2.s_t0),this.m_perp);this.m_s2=box2d.b2CrossVV(m,this.m_perp);this.m_K.ex.x=b+d+f*this.m_s1*this.m_s1+p*this.m_s2*this.m_s2;this.m_K.ex.y=f*this.m_s1+p*this.m_s2;this.m_K.ex.z=f*this.m_s1*this.m_a1+p*this.m_s2*this.m_a2;this.m_K.ey.x=this.m_K.ex.y;this.m_K.ey.y=f+p;0===this.m_K.ey.y&&(this.m_K.ey.y=1);this.m_K.ey.z=f*this.m_a1+p*this.m_a2;this.m_K.ez.x=this.m_K.ex.z;this.m_K.ez.y=this.m_K.ey.z;this.m_K.ez.z=b+d+f*this.m_a1*this.m_a1+p*this.m_a2*this.m_a2;this.m_enableLimit?(l=box2d.b2DotVV(this.m_axis,
n),box2d.b2Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*box2d.b2_linearSlop?this.m_limitState=box2d.b2LimitState.e_equalLimits:l<=this.m_lowerTranslation?this.m_limitState!==box2d.b2LimitState.e_atLowerLimit&&(this.m_limitState=box2d.b2LimitState.e_atLowerLimit,this.m_impulse.z=0):l>=this.m_upperTranslation?this.m_limitState!==box2d.b2LimitState.e_atUpperLimit&&(this.m_limitState=box2d.b2LimitState.e_atUpperLimit,this.m_impulse.z=0):(this.m_limitState=box2d.b2LimitState.e_inactiveLimit,
this.m_impulse.z=0)):(this.m_limitState=box2d.b2LimitState.e_inactiveLimit,this.m_impulse.z=0);!1===this.m_enableMotor&&(this.m_motorImpulse=0);a.step.warmStarting?(this.m_impulse.SelfMul(a.step.dtRatio),this.m_motorImpulse*=a.step.dtRatio,l=box2d.b2AddVV(box2d.b2MulSV(this.m_impulse.x,this.m_perp,box2d.b2Vec2.s_t0),box2d.b2MulSV(this.m_motorImpulse+this.m_impulse.z,this.m_axis,box2d.b2Vec2.s_t1),box2d.b2PrismaticJoint.prototype.InitVelocityConstraints.s_P),k=this.m_impulse.x*this.m_s1+this.m_impulse.y+
(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,m=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2,c.SelfMulSub(b,l),e-=f*k,g.SelfMulAdd(d,l),h+=p*m):(this.m_impulse.SetZero(),this.m_motorImpulse=0);a.velocities[this.m_indexA].w=e;a.velocities[this.m_indexB].w=h};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"InitVelocityConstraints",box2d.b2PrismaticJoint.prototype.InitVelocityConstraints);
box2d.b2PrismaticJoint.prototype.InitVelocityConstraints.s_d=new box2d.b2Vec2;box2d.b2PrismaticJoint.prototype.InitVelocityConstraints.s_P=new box2d.b2Vec2;
box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints=function(a){var b=a.velocities[this.m_indexA].v,c=a.velocities[this.m_indexA].w,e=a.velocities[this.m_indexB].v,d=a.velocities[this.m_indexB].w,f=this.m_invMassA,g=this.m_invMassB,h=this.m_invIA,l=this.m_invIB;if(this.m_enableMotor&&this.m_limitState!==box2d.b2LimitState.e_equalLimits){var k=box2d.b2DotVV(this.m_axis,box2d.b2SubVV(e,b,box2d.b2Vec2.s_t0))+this.m_a2*d-this.m_a1*c,k=this.m_motorMass*(this.m_motorSpeed-k),m=this.m_motorImpulse,
n=a.step.dt*this.m_maxMotorForce;this.m_motorImpulse=box2d.b2Clamp(this.m_motorImpulse+k,-n,n);k=this.m_motorImpulse-m;m=box2d.b2MulSV(k,this.m_axis,box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints.s_P);n=k*this.m_a1;k*=this.m_a2;b.SelfMulSub(f,m);c-=h*n;e.SelfMulAdd(g,m);d+=l*k}var n=box2d.b2DotVV(this.m_perp,box2d.b2SubVV(e,b,box2d.b2Vec2.s_t0))+this.m_s2*d-this.m_s1*c,p=d-c;this.m_enableLimit&&this.m_limitState!==box2d.b2LimitState.e_inactiveLimit?(k=box2d.b2DotVV(this.m_axis,box2d.b2SubVV(e,
b,box2d.b2Vec2.s_t0))+this.m_a2*d-this.m_a1*c,m=box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints.s_f1.Copy(this.m_impulse),k=this.m_K.Solve33(-n,-p,-k,box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints.s_df3),this.m_impulse.SelfAdd(k),this.m_limitState===box2d.b2LimitState.e_atLowerLimit?this.m_impulse.z=box2d.b2Max(this.m_impulse.z,0):this.m_limitState===box2d.b2LimitState.e_atUpperLimit&&(this.m_impulse.z=box2d.b2Min(this.m_impulse.z,0)),n=this.m_K.Solve22(-n-(this.m_impulse.z-m.z)*
this.m_K.ez.x,-p-(this.m_impulse.z-m.z)*this.m_K.ez.y,box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints.s_f2r),n.x+=m.x,n.y+=m.y,this.m_impulse.x=n.x,this.m_impulse.y=n.y,k.x=this.m_impulse.x-m.x,k.y=this.m_impulse.y-m.y,k.z=this.m_impulse.z-m.z,m=box2d.b2AddVV(box2d.b2MulSV(k.x,this.m_perp,box2d.b2Vec2.s_t0),box2d.b2MulSV(k.z,this.m_axis,box2d.b2Vec2.s_t1),box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints.s_P),n=k.x*this.m_s1+k.y+k.z*this.m_a1,k=k.x*this.m_s2+k.y+k.z*this.m_a2):(k=
this.m_K.Solve22(-n,-p,box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints.s_df2),this.m_impulse.x+=k.x,this.m_impulse.y+=k.y,m=box2d.b2MulSV(k.x,this.m_perp,box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints.s_P),n=k.x*this.m_s1+k.y,k=k.x*this.m_s2+k.y);b.SelfMulSub(f,m);c-=h*n;e.SelfMulAdd(g,m);a.velocities[this.m_indexA].w=c;a.velocities[this.m_indexB].w=d+l*k};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"SolveVelocityConstraints",box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints);
box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints.s_P=new box2d.b2Vec2;box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints.s_f2r=new box2d.b2Vec2;box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints.s_f1=new box2d.b2Vec3;box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints.s_df3=new box2d.b2Vec3;box2d.b2PrismaticJoint.prototype.SolveVelocityConstraints.s_df2=new box2d.b2Vec2;
box2d.b2PrismaticJoint.prototype.SolvePositionConstraints=function(a){var b=a.positions[this.m_indexA].c,c=a.positions[this.m_indexA].a,e=a.positions[this.m_indexB].c,d=a.positions[this.m_indexB].a,f=this.m_qA.SetAngleRadians(c),g=this.m_qB.SetAngleRadians(d),h=this.m_invMassA,l=this.m_invMassB,k=this.m_invIA,m=this.m_invIB,n=box2d.b2MulRV(f,this.m_lalcA,this.m_rA),p=box2d.b2MulRV(g,this.m_lalcB,this.m_rB),q=box2d.b2SubVV(box2d.b2AddVV(e,p,box2d.b2Vec2.s_t0),box2d.b2AddVV(b,n,box2d.b2Vec2.s_t1),box2d.b2PrismaticJoint.prototype.SolvePositionConstraints.s_d),
r=box2d.b2MulRV(f,this.m_localXAxisA,this.m_axis),t=box2d.b2CrossVV(box2d.b2AddVV(q,n,box2d.b2Vec2.s_t0),r),g=box2d.b2CrossVV(p,r),f=box2d.b2MulRV(f,this.m_localYAxisA,this.m_perp),s=box2d.b2CrossVV(box2d.b2AddVV(q,n,box2d.b2Vec2.s_t0),f),u=box2d.b2CrossVV(p,f),v=box2d.b2PrismaticJoint.prototype.SolvePositionConstraints.s_impulse,y=box2d.b2DotVV(f,q),D=d-c-this.m_referenceAngle,n=box2d.b2Abs(y),p=box2d.b2Abs(D),x=!1,w=0;this.m_enableLimit&&(q=box2d.b2DotVV(r,q),box2d.b2Abs(this.m_upperTranslation-
this.m_lowerTranslation)<2*box2d.b2_linearSlop?(w=box2d.b2Clamp(q,-box2d.b2_maxLinearCorrection,box2d.b2_maxLinearCorrection),n=box2d.b2Max(n,box2d.b2Abs(q)),x=!0):q<=this.m_lowerTranslation?(w=box2d.b2Clamp(q-this.m_lowerTranslation+box2d.b2_linearSlop,-box2d.b2_maxLinearCorrection,0),n=box2d.b2Max(n,this.m_lowerTranslation-q),x=!0):q>=this.m_upperTranslation&&(w=box2d.b2Clamp(q-this.m_upperTranslation-box2d.b2_linearSlop,0,box2d.b2_maxLinearCorrection),n=box2d.b2Max(n,q-this.m_upperTranslation),
x=!0));if(x){var q=k*s+m*u,C=k*s*t+m*u*g,x=k+m;0===x&&(x=1);var A=k*t+m*g,E=h+l+k*t*t+m*g*g,B=this.m_K3;B.ex.SetXYZ(h+l+k*s*s+m*u*u,q,C);B.ey.SetXYZ(q,x,A);B.ez.SetXYZ(C,A,E);v=B.Solve33(-y,-D,-w,v)}else q=k*s+m*u,x=k+m,0===x&&(x=1),w=this.m_K2,w.ex.SetXY(h+l+k*s*s+m*u*u,q),w.ey.SetXY(q,x),y=w.Solve(-y,-D,box2d.b2PrismaticJoint.prototype.SolvePositionConstraints.s_impulse1),v.x=y.x,v.y=y.y,v.z=0;r=box2d.b2AddVV(box2d.b2MulSV(v.x,f,box2d.b2Vec2.s_t0),box2d.b2MulSV(v.z,r,box2d.b2Vec2.s_t1),box2d.b2PrismaticJoint.prototype.SolvePositionConstraints.s_P);
t=v.x*s+v.y+v.z*t;g=v.x*u+v.y+v.z*g;b.SelfMulSub(h,r);c-=k*t;e.SelfMulAdd(l,r);a.positions[this.m_indexA].a=c;a.positions[this.m_indexB].a=d+m*g;return n<=box2d.b2_linearSlop&&p<=box2d.b2_angularSlop};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"SolvePositionConstraints",box2d.b2PrismaticJoint.prototype.SolvePositionConstraints);box2d.b2PrismaticJoint.prototype.SolvePositionConstraints.s_d=new box2d.b2Vec2;box2d.b2PrismaticJoint.prototype.SolvePositionConstraints.s_impulse=new box2d.b2Vec3;
box2d.b2PrismaticJoint.prototype.SolvePositionConstraints.s_impulse1=new box2d.b2Vec2;box2d.b2PrismaticJoint.prototype.SolvePositionConstraints.s_P=new box2d.b2Vec2;box2d.b2PrismaticJoint.prototype.GetAnchorA=function(a){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,a)};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetAnchorA",box2d.b2PrismaticJoint.prototype.GetAnchorA);box2d.b2PrismaticJoint.prototype.GetAnchorB=function(a){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,a)};
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetAnchorB",box2d.b2PrismaticJoint.prototype.GetAnchorB);box2d.b2PrismaticJoint.prototype.GetReactionForce=function(a,b){return b.SetXY(a*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),a*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y))};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetReactionForce",box2d.b2PrismaticJoint.prototype.GetReactionForce);
box2d.b2PrismaticJoint.prototype.GetReactionTorque=function(a){return a*this.m_impulse.y};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetReactionTorque",box2d.b2PrismaticJoint.prototype.GetReactionTorque);box2d.b2PrismaticJoint.prototype.GetLocalAnchorA=function(a){return a.Copy(this.m_localAnchorA)};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetLocalAnchorA",box2d.b2PrismaticJoint.prototype.GetLocalAnchorA);box2d.b2PrismaticJoint.prototype.GetLocalAnchorB=function(a){return a.Copy(this.m_localAnchorB)};
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetLocalAnchorB",box2d.b2PrismaticJoint.prototype.GetLocalAnchorB);box2d.b2PrismaticJoint.prototype.GetLocalAxisA=function(a){return a.Copy(this.m_localXAxisA)};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetLocalAxisA",box2d.b2PrismaticJoint.prototype.GetLocalAxisA);box2d.b2PrismaticJoint.prototype.GetReferenceAngle=function(){return this.m_referenceAngle};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetReferenceAngle",box2d.b2PrismaticJoint.prototype.GetReferenceAngle);
box2d.b2PrismaticJoint.prototype.GetJointTranslation=function(){var a=this.m_bodyA.GetWorldPoint(this.m_localAnchorA,box2d.b2PrismaticJoint.prototype.GetJointTranslation.s_pA),b=this.m_bodyB.GetWorldPoint(this.m_localAnchorB,box2d.b2PrismaticJoint.prototype.GetJointTranslation.s_pB),a=box2d.b2SubVV(b,a,box2d.b2PrismaticJoint.prototype.GetJointTranslation.s_d),b=this.m_bodyA.GetWorldVector(this.m_localXAxisA,box2d.b2PrismaticJoint.prototype.GetJointTranslation.s_axis);return box2d.b2DotVV(a,b)};
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetJointTranslation",box2d.b2PrismaticJoint.prototype.GetJointTranslation);box2d.b2PrismaticJoint.prototype.GetJointTranslation.s_pA=new box2d.b2Vec2;box2d.b2PrismaticJoint.prototype.GetJointTranslation.s_pB=new box2d.b2Vec2;box2d.b2PrismaticJoint.prototype.GetJointTranslation.s_d=new box2d.b2Vec2;box2d.b2PrismaticJoint.prototype.GetJointTranslation.s_axis=new box2d.b2Vec2;
box2d.b2PrismaticJoint.prototype.GetJointSpeed=function(){var a=this.m_bodyA,b=this.m_bodyB;box2d.b2SubVV(this.m_localAnchorA,a.m_sweep.localCenter,this.m_lalcA);var c=box2d.b2MulRV(a.m_xf.q,this.m_lalcA,this.m_rA);box2d.b2SubVV(this.m_localAnchorB,b.m_sweep.localCenter,this.m_lalcB);var e=box2d.b2MulRV(b.m_xf.q,this.m_lalcB,this.m_rB),d=box2d.b2AddVV(a.m_sweep.c,c,box2d.b2Vec2.s_t0),f=box2d.b2AddVV(b.m_sweep.c,e,box2d.b2Vec2.s_t1),d=box2d.b2SubVV(f,d,box2d.b2Vec2.s_t2),f=a.GetWorldVector(this.m_localXAxisA,
this.m_axis),g=a.m_linearVelocity,h=b.m_linearVelocity,a=a.m_angularVelocity,b=b.m_angularVelocity;return box2d.b2DotVV(d,box2d.b2CrossSV(a,f,box2d.b2Vec2.s_t0))+box2d.b2DotVV(f,box2d.b2SubVV(box2d.b2AddVCrossSV(h,b,e,box2d.b2Vec2.s_t0),box2d.b2AddVCrossSV(g,a,c,box2d.b2Vec2.s_t1),box2d.b2Vec2.s_t0))};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetJointSpeed",box2d.b2PrismaticJoint.prototype.GetJointSpeed);box2d.b2PrismaticJoint.prototype.IsLimitEnabled=function(){return this.m_enableLimit};
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"IsLimitEnabled",box2d.b2PrismaticJoint.prototype.IsLimitEnabled);box2d.b2PrismaticJoint.prototype.EnableLimit=function(a){a!==this.m_enableLimit&&(this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=a,this.m_impulse.z=0)};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"EnableLimit",box2d.b2PrismaticJoint.prototype.EnableLimit);box2d.b2PrismaticJoint.prototype.GetLowerLimit=function(){return this.m_lowerTranslation};
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetLowerLimit",box2d.b2PrismaticJoint.prototype.GetLowerLimit);box2d.b2PrismaticJoint.prototype.GetUpperLimit=function(){return this.m_upperTranslation};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetUpperLimit",box2d.b2PrismaticJoint.prototype.GetUpperLimit);
box2d.b2PrismaticJoint.prototype.SetLimits=function(a,b){if(a!==this.m_lowerTranslation||b!==this.m_upperTranslation)this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_lowerTranslation=a,this.m_upperTranslation=b,this.m_impulse.z=0};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"SetLimits",box2d.b2PrismaticJoint.prototype.SetLimits);box2d.b2PrismaticJoint.prototype.IsMotorEnabled=function(){return this.m_enableMotor};
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"IsMotorEnabled",box2d.b2PrismaticJoint.prototype.IsMotorEnabled);box2d.b2PrismaticJoint.prototype.EnableMotor=function(a){this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0);this.m_enableMotor=a};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"EnableMotor",box2d.b2PrismaticJoint.prototype.EnableMotor);box2d.b2PrismaticJoint.prototype.SetMotorSpeed=function(a){this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0);this.m_motorSpeed=a};
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"SetMotorSpeed",box2d.b2PrismaticJoint.prototype.SetMotorSpeed);box2d.b2PrismaticJoint.prototype.GetMotorSpeed=function(){return this.m_motorSpeed};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetMotorSpeed",box2d.b2PrismaticJoint.prototype.GetMotorSpeed);box2d.b2PrismaticJoint.prototype.SetMaxMotorForce=function(a){this.m_bodyA.SetAwake(!0);this.m_bodyB.SetAwake(!0);this.m_maxMotorForce=a};
goog.exportProperty(box2d.b2PrismaticJoint.prototype,"SetMaxMotorForce",box2d.b2PrismaticJoint.prototype.SetMaxMotorForce);box2d.b2PrismaticJoint.prototype.GetMaxMotorForce=function(){return this.m_maxMotorForce};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetMaxMotorForce",box2d.b2PrismaticJoint.prototype.GetMaxMotorForce);box2d.b2PrismaticJoint.prototype.GetMotorForce=function(a){return a*this.m_motorImpulse};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"GetMotorForce",box2d.b2PrismaticJoint.prototype.GetMotorForce);
box2d.b2PrismaticJoint.prototype.Dump=function(){if(box2d.DEBUG){var a=this.m_bodyA.m_islandIndex,b=this.m_bodyB.m_islandIndex;box2d.b2Log("  /*box2d.b2PrismaticJointDef*/ var jd = new box2d.b2PrismaticJointDef();\n");box2d.b2Log("  jd.bodyA = bodies[%d];\n",a);box2d.b2Log("  jd.bodyB = bodies[%d];\n",b);box2d.b2Log("  jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false");box2d.b2Log("  jd.localAnchorA.SetXY(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y);box2d.b2Log("  jd.localAnchorB.SetXY(%.15f, %.15f);\n",
this.m_localAnchorB.x,this.m_localAnchorB.y);box2d.b2Log("  jd.localAxisA.SetXY(%.15f, %.15f);\n",this.m_localXAxisA.x,this.m_localXAxisA.y);box2d.b2Log("  jd.referenceAngle = %.15f;\n",this.m_referenceAngle);box2d.b2Log("  jd.enableLimit = %s;\n",this.m_enableLimit?"true":"false");box2d.b2Log("  jd.lowerTranslation = %.15f;\n",this.m_lowerTranslation);box2d.b2Log("  jd.upperTranslation = %.15f;\n",this.m_upperTranslation);box2d.b2Log("  jd.enableMotor = %s;\n",this.m_enableMotor?"true":"false");
box2d.b2Log("  jd.motorSpeed = %.15f;\n",this.m_motorSpeed);box2d.b2Log("  jd.maxMotorForce = %.15f;\n",this.m_maxMotorForce);box2d.b2Log("  joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)}};goog.exportProperty(box2d.b2PrismaticJoint.prototype,"Dump",box2d.b2PrismaticJoint.prototype.Dump);box2d.b2GearJointDef=function(){box2d.b2JointDef.call(this,box2d.b2JointType.e_gearJoint)};goog.inherits(box2d.b2GearJointDef,box2d.b2JointDef);goog.exportSymbol("box2d.b2GearJointDef",box2d.b2GearJointDef);box2d.b2GearJointDef.prototype.joint1=null;goog.exportProperty(box2d.b2GearJointDef.prototype,"joint1",box2d.b2GearJointDef.prototype.joint1);box2d.b2GearJointDef.prototype.joint2=null;goog.exportProperty(box2d.b2GearJointDef.prototype,"joint2",box2d.b2GearJointDef.prototype.joint2);
box2d.b2GearJointDef.prototype.ratio=1;goog.exportProperty(box2d.b2GearJointDef.prototype,"ratio",box2d.b2GearJointDef.prototype.ratio);
box2d.b2GearJoint=function(a){box2d.b2Joint.call(this,a);this.m_joint1=a.joint1;this.m_joint2=a.joint2;this.m_localAnchorA=new box2d.b2Vec2;this.m_localAnchorB=new box2d.b2Vec2;this.m_localAnchorC=new box2d.b2Vec2;this.m_localAnchorD=new box2d.b2Vec2;this.m_localAxisC=new box2d.b2Vec2;this.m_localAxisD=new box2d.b2Vec2;this.m_lcA=new box2d.b2Vec2;this.m_lcB=new box2d.b2Vec2;this.m_lcC=new box2d.b2Vec2;this.m_lcD=new box2d.b2Vec2;this.m_JvAC=new box2d.b2Vec2;this.m_JvBD=new box2d.b2Vec2;this.m_qA=
new box2d.b2Rot;this.m_qB=new box2d.b2Rot;this.m_qC=new box2d.b2Rot;this.m_qD=new box2d.b2Rot;this.m_lalcA=new box2d.b2Vec2;this.m_lalcB=new box2d.b2Vec2;this.m_lalcC=new box2d.b2Vec2;this.m_lalcD=new box2d.b2Vec2;this.m_typeA=this.m_joint1.GetType();this.m_typeB=this.m_joint2.GetType();box2d.ENABLE_ASSERTS&&box2d.b2Assert(this.m_typeA===box2d.b2JointType.e_revoluteJoint||this.m_typeA===box2d.b2JointType.e_prismaticJoint);box2d.ENABLE_ASSERTS&&box2d.b2Assert(this.m_typeB===box2d.b2JointType.e_revoluteJoint||
this.m_typeB===box2d.b2JointType.e_prismaticJoint);var b,c;this.m_bodyC=this.m_joint1.GetBodyA();this.m_bodyA=this.m_joint1.GetBodyB();b=this.m_bodyA.m_xf;var e=this.m_bodyA.m_sweep.a;c=this.m_bodyC.m_xf;var d=this.m_bodyC.m_sweep.a;this.m_typeA===box2d.b2JointType.e_revoluteJoint?(c=a.joint1,this.m_localAnchorC.Copy(c.m_localAnchorA),this.m_localAnchorA.Copy(c.m_localAnchorB),this.m_referenceAngleA=c.m_referenceAngle,this.m_localAxisC.SetZero(),b=e-d-this.m_referenceAngleA):(d=a.joint1,this.m_localAnchorC.Copy(d.m_localAnchorA),
this.m_localAnchorA.Copy(d.m_localAnchorB),this.m_referenceAngleA=d.m_referenceAngle,this.m_localAxisC.Copy(d.m_localXAxisA),e=this.m_localAnchorC,b=box2d.b2MulTRV(c.q,box2d.b2AddVV(box2d.b2MulRV(b.q,this.m_localAnchorA,box2d.b2Vec2.s_t0),box2d.b2SubVV(b.p,c.p,box2d.b2Vec2.s_t1),box2d.b2Vec2.s_t0),box2d.b2Vec2.s_t0),b=box2d.b2DotVV(box2d.b2SubVV(b,e,box2d.b2Vec2.s_t0),this.m_localAxisC));this.m_bodyD=this.m_joint2.GetBodyA();this.m_bodyB=this.m_joint2.GetBodyB();c=this.m_bodyB.m_xf;var d=this.m_bodyB.m_sweep.a,
e=this.m_bodyD.m_xf,f=this.m_bodyD.m_sweep.a;this.m_typeB===box2d.b2JointType.e_revoluteJoint?(c=a.joint2,this.m_localAnchorD.Copy(c.m_localAnchorA),this.m_localAnchorB.Copy(c.m_localAnchorB),this.m_referenceAngleB=c.m_referenceAngle,this.m_localAxisD.SetZero(),c=d-f-this.m_referenceAngleB):(d=a.joint2,this.m_localAnchorD.Copy(d.m_localAnchorA),this.m_localAnchorB.Copy(d.m_localAnchorB),this.m_referenceAngleB=d.m_referenceAngle,this.m_localAxisD.Copy(d.m_localXAxisA),d=this.m_localAnchorD,c=box2d.b2MulTRV(e.q,
box2d.b2AddVV(box2d.b2MulRV(c.q,this.m_localAnchorB,box2d.b2Vec2.s_t0),box2d.b2SubVV(c.p,e.p,box2d.b2Vec2.s_t1),box2d.b2Vec2.s_t0),box2d.b2Vec2.s_t0),c=box2d.b2DotVV(box2d.b2SubVV(c,d,box2d.b2Vec2.s_t0),this.m_localAxisD));this.m_ratio=a.ratio;this.m_constant=b+this.m_ratio*c;this.m_impulse=0};goog.inherits(box2d.b2GearJoint,box2d.b2Joint);goog.exportSymbol("box2d.b2GearJoint",box2d.b2GearJoint);box2d.b2GearJoint.prototype.m_joint1=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_joint1",box2d.b2GearJoint.prototype.m_joint1);
box2d.b2GearJoint.prototype.m_joint2=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_joint2",box2d.b2GearJoint.prototype.m_joint2);box2d.b2GearJoint.prototype.m_typeA=box2d.b2JointType.e_unknownJoint;goog.exportProperty(box2d.b2GearJoint.prototype,"m_typeA",box2d.b2GearJoint.prototype.m_typeA);box2d.b2GearJoint.prototype.m_typeB=box2d.b2JointType.e_unknownJoint;goog.exportProperty(box2d.b2GearJoint.prototype,"m_typeB",box2d.b2GearJoint.prototype.m_typeB);
box2d.b2GearJoint.prototype.m_bodyC=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_bodyC",box2d.b2GearJoint.prototype.m_bodyC);box2d.b2GearJoint.prototype.m_bodyD=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_bodyD",box2d.b2GearJoint.prototype.m_bodyD);box2d.b2GearJoint.prototype.m_localAnchorA=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_localAnchorA",box2d.b2GearJoint.prototype.m_localAnchorA);box2d.b2GearJoint.prototype.m_localAnchorB=null;
goog.exportProperty(box2d.b2GearJoint.prototype,"m_localAnchorB",box2d.b2GearJoint.prototype.m_localAnchorB);box2d.b2GearJoint.prototype.m_localAnchorC=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_localAnchorC",box2d.b2GearJoint.prototype.m_localAnchorC);box2d.b2GearJoint.prototype.m_localAnchorD=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_localAnchorD",box2d.b2GearJoint.prototype.m_localAnchorD);box2d.b2GearJoint.prototype.m_localAxisC=null;
goog.exportProperty(box2d.b2GearJoint.prototype,"m_localAxisC",box2d.b2GearJoint.prototype.m_localAxisC);box2d.b2GearJoint.prototype.m_localAxisD=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_localAxisD",box2d.b2GearJoint.prototype.m_localAxisD);box2d.b2GearJoint.prototype.m_referenceAngleA=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_referenceAngleA",box2d.b2GearJoint.prototype.m_referenceAngleA);box2d.b2GearJoint.prototype.m_referenceAngleB=0;
goog.exportProperty(box2d.b2GearJoint.prototype,"m_referenceAngleB",box2d.b2GearJoint.prototype.m_referenceAngleB);box2d.b2GearJoint.prototype.m_constant=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_constant",box2d.b2GearJoint.prototype.m_constant);box2d.b2GearJoint.prototype.m_ratio=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_ratio",box2d.b2GearJoint.prototype.m_ratio);box2d.b2GearJoint.prototype.m_impulse=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_impulse",box2d.b2GearJoint.prototype.m_impulse);
box2d.b2GearJoint.prototype.m_indexA=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_indexA",box2d.b2GearJoint.prototype.m_indexA);box2d.b2GearJoint.prototype.m_indexB=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_indexB",box2d.b2GearJoint.prototype.m_indexB);box2d.b2GearJoint.prototype.m_indexC=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_indexC",box2d.b2GearJoint.prototype.m_indexC);box2d.b2GearJoint.prototype.m_indexD=0;
goog.exportProperty(box2d.b2GearJoint.prototype,"m_indexD",box2d.b2GearJoint.prototype.m_indexD);box2d.b2GearJoint.prototype.m_lcA=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_lcA",box2d.b2GearJoint.prototype.m_lcA);box2d.b2GearJoint.prototype.m_lcB=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_lcB",box2d.b2GearJoint.prototype.m_lcB);box2d.b2GearJoint.prototype.m_lcC=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_lcC",box2d.b2GearJoint.prototype.m_lcC);
box2d.b2GearJoint.prototype.m_lcD=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_lcD",box2d.b2GearJoint.prototype.m_lcD);box2d.b2GearJoint.prototype.m_mA=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_mA",box2d.b2GearJoint.prototype.m_mA);box2d.b2GearJoint.prototype.m_mB=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_mB",box2d.b2GearJoint.prototype.m_mB);box2d.b2GearJoint.prototype.m_mC=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_mC",box2d.b2GearJoint.prototype.m_mC);
box2d.b2GearJoint.prototype.m_mD=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_mD",box2d.b2GearJoint.prototype.m_mD);box2d.b2GearJoint.prototype.m_iA=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_iA",box2d.b2GearJoint.prototype.m_iA);box2d.b2GearJoint.prototype.m_iB=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_iB",box2d.b2GearJoint.prototype.m_iB);box2d.b2GearJoint.prototype.m_iC=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_iC",box2d.b2GearJoint.prototype.m_iC);
box2d.b2GearJoint.prototype.m_iD=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_iD",box2d.b2GearJoint.prototype.m_iD);box2d.b2GearJoint.prototype.m_JvAC=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_JvAC",box2d.b2GearJoint.prototype.m_JvAC);box2d.b2GearJoint.prototype.m_JvBD=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_JvBD",box2d.b2GearJoint.prototype.m_JvBD);box2d.b2GearJoint.prototype.m_JwA=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_JwA",box2d.b2GearJoint.prototype.m_JwA);
box2d.b2GearJoint.prototype.m_JwB=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_JwB",box2d.b2GearJoint.prototype.m_JwB);box2d.b2GearJoint.prototype.m_JwC=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_JwC",box2d.b2GearJoint.prototype.m_JwC);box2d.b2GearJoint.prototype.m_JwD=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_JwD",box2d.b2GearJoint.prototype.m_JwD);box2d.b2GearJoint.prototype.m_mass=0;goog.exportProperty(box2d.b2GearJoint.prototype,"m_mass",box2d.b2GearJoint.prototype.m_mass);
box2d.b2GearJoint.prototype.m_qA=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_qA",box2d.b2GearJoint.prototype.m_qA);box2d.b2GearJoint.prototype.m_qB=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_qB",box2d.b2GearJoint.prototype.m_qB);box2d.b2GearJoint.prototype.m_qC=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_qC",box2d.b2GearJoint.prototype.m_qC);box2d.b2GearJoint.prototype.m_qD=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_qD",box2d.b2GearJoint.prototype.m_qD);
box2d.b2GearJoint.prototype.m_lalcA=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_lalcA",box2d.b2GearJoint.prototype.m_lalcA);box2d.b2GearJoint.prototype.m_lalcB=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_lalcB",box2d.b2GearJoint.prototype.m_lalcB);box2d.b2GearJoint.prototype.m_lalcC=null;goog.exportProperty(box2d.b2GearJoint.prototype,"m_lalcC",box2d.b2GearJoint.prototype.m_lalcC);box2d.b2GearJoint.prototype.m_lalcD=null;
goog.exportProperty(box2d.b2GearJoint.prototype,"m_lalcD",box2d.b2GearJoint.prototype.m_lalcD);
box2d.b2GearJoint.prototype.InitVelocityConstraints=function(a){this.m_indexA=this.m_bodyA.m_islandIndex;this.m_indexB=this.m_bodyB.m_islandIndex;this.m_indexC=this.m_bodyC.m_islandIndex;this.m_indexD=this.m_bodyD.m_islandIndex;this.m_lcA.Copy(this.m_bodyA.m_sweep.localCenter);this.m_lcB.Copy(this.m_bodyB.m_sweep.localCenter);this.m_lcC.Copy(this.m_bodyC.m_sweep.localCenter);this.m_lcD.Copy(this.m_bodyD.m_sweep.localCenter);this.m_mA=this.m_bodyA.m_invMass;this.m_mB=this.m_bodyB.m_invMass;this.m_mC=
this.m_bodyC.m_invMass;this.m_mD=this.m_bodyD.m_invMass;this.m_iA=this.m_bodyA.m_invI;this.m_iB=this.m_bodyB.m_invI;this.m_iC=this.m_bodyC.m_invI;this.m_iD=this.m_bodyD.m_invI;var b=a.velocities[this.m_indexA].v,c=a.velocities[this.m_indexA].w,e=a.positions[this.m_indexB].a,d=a.velocities[this.m_indexB].v,f=a.velocities[this.m_indexB].w,g=a.positions[this.m_indexC].a,h=a.velocities[this.m_indexC].v,l=a.velocities[this.m_indexC].w,k=a.positions[this.m_indexD].a,m=a.velocities[this.m_indexD].v,n=a.velocities[this.m_indexD].w,
p=this.m_qA.SetAngleRadians(a.positions[this.m_indexA].a),e=this.m_qB.SetAngleRadians(e),q=this.m_qC.SetAngleRadians(g),g=this.m_qD.SetAngleRadians(k);this.m_mass=0;this.m_typeA===box2d.b2JointType.e_revoluteJoint?(this.m_JvAC.SetZero(),this.m_JwC=this.m_JwA=1,this.m_mass+=this.m_iA+this.m_iC):(k=box2d.b2MulRV(q,this.m_localAxisC,box2d.b2GearJoint.prototype.InitVelocityConstraints.s_u),box2d.b2SubVV(this.m_localAnchorC,this.m_lcC,this.m_lalcC),q=box2d.b2MulRV(q,this.m_lalcC,box2d.b2GearJoint.prototype.InitVelocityConstraints.s_rC),
box2d.b2SubVV(this.m_localAnchorA,this.m_lcA,this.m_lalcA),p=box2d.b2MulRV(p,this.m_lalcA,box2d.b2GearJoint.prototype.InitVelocityConstraints.s_rA),this.m_JvAC.Copy(k),this.m_JwC=box2d.b2CrossVV(q,k),this.m_JwA=box2d.b2CrossVV(p,k),this.m_mass+=this.m_mC+this.m_mA+this.m_iC*this.m_JwC*this.m_JwC+this.m_iA*this.m_JwA*this.m_JwA);this.m_typeB===box2d.b2JointType.e_revoluteJoint?(this.m_JvBD.SetZero(),this.m_JwD=this.m_JwB=this.m_ratio,this.m_mass+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD)):(k=
box2d.b2MulRV(g,this.m_localAxisD,box2d.b2GearJoint.prototype.InitVelocityConstraints.s_u),box2d.b2SubVV(this.m_localAnchorD,this.m_lcD,this.m_lalcD),p=box2d.b2MulRV(g,this.m_lalcD,box2d.b2GearJoint.prototype.InitVelocityConstraints.s_rD),box2d.b2SubVV(this.m_localAnchorB,this.m_lcB,this.m_lalcB),e=box2d.b2MulRV(e,this.m_lalcB,box2d.b2GearJoint.prototype.InitVelocityConstraints.s_rB),box2d.b2MulSV(this.m_ratio,k,this.m_JvBD),this.m_JwD=this.m_ratio*box2d.b2CrossVV(p,k),this.m_JwB=this.m_ratio*box2d.b2CrossVV(e,
k),this.m_mass+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*this.m_JwD*this.m_JwD+this.m_iB*this.m_JwB*this.m_JwB);this.m_mass=0<this.m_mass?1/this.m_mass:0;a.step.warmStarting?(b.SelfMulAdd(this.m_mA*this.m_impulse,this.m_JvAC),c+=this.m_iA*this.m_impulse*this.m_JwA,d.SelfMulAdd(this.m_mB*this.m_impulse,this.m_JvBD),f+=this.m_iB*this.m_impulse*this.m_JwB,h.SelfMulSub(this.m_mC*this.m_impulse,this.m_JvAC),l-=this.m_iC*this.m_impulse*this.m_JwC,m.SelfMulSub(this.m_mD*this.m_impulse,this.m_JvBD),
n-=this.m_iD*this.m_impulse*this.m_JwD):this.m_impulse=0;a.velocities[this.m_indexA].w=c;a.velocities[this.m_indexB].w=f;a.velocities[this.m_indexC].w=l;a.velocities[this.m_indexD].w=n};box2d.b2GearJoint.prototype.InitVelocityConstraints.s_u=new box2d.b2Vec2;box2d.b2GearJoint.prototype.InitVelocityConstraints.s_rA=new box2d.b2Vec2;box2d.b2GearJoint.prototype.InitVelocityConstraints.s_rB=new box2d.b2Vec2;box2d.b2GearJoint.prototype.InitVelocityConstraints.s_rC=new box2d.b2Vec2;
box2d.b2GearJoint.prototype.InitVelocityConstraints.s_rD=new box2d.b2Vec2;
box2d.b2GearJoint.prototype.SolveVelocityConstraints=function(a){var b=a.velocities[this.m_indexA].v,c=a.velocities[this.m_indexA].w,e=a.velocities[this.m_indexB].v,d=a.velocities[this.m_indexB].w,f=a.velocities[this.m_indexC].v,g=a.velocities[this.m_indexC].w,h=a.velocities[this.m_indexD].v,l=a.velocities[this.m_indexD].w,k=box2d.b2DotVV(this.m_JvAC,box2d.b2SubVV(b,f,box2d.b2Vec2.s_t0))+box2d.b2DotVV(this.m_JvBD,box2d.b2SubVV(e,h,box2d.b2Vec2.s_t0)),k=k+(this.m_JwA*c-this.m_JwC*g+(this.m_JwB*d-this.m_JwD*
l)),k=-this.m_mass*k;this.m_impulse+=k;b.SelfMulAdd(this.m_mA*k,this.m_JvAC);c+=this.m_iA*k*this.m_JwA;e.SelfMulAdd(this.m_mB*k,this.m_JvBD);d+=this.m_iB*k*this.m_JwB;f.SelfMulSub(this.m_mC*k,this.m_JvAC);g-=this.m_iC*k*this.m_JwC;h.SelfMulSub(this.m_mD*k,this.m_JvBD);l-=this.m_iD*k*this.m_JwD;a.velocities[this.m_indexA].w=c;a.velocities[this.m_indexB].w=d;a.velocities[this.m_indexC].w=g;a.velocities[this.m_indexD].w=l};
box2d.b2GearJoint.prototype.SolvePositionConstraints=function(a){var b=a.positions[this.m_indexA].c,c=a.positions[this.m_indexA].a,e=a.positions[this.m_indexB].c,d=a.positions[this.m_indexB].a,f=a.positions[this.m_indexC].c,g=a.positions[this.m_indexC].a,h=a.positions[this.m_indexD].c,l=a.positions[this.m_indexD].a,k=this.m_qA.SetAngleRadians(c),m=this.m_qB.SetAngleRadians(d),n=this.m_qC.SetAngleRadians(g),p=this.m_qD.SetAngleRadians(l),q=this.m_JvAC,r=this.m_JvBD,t,s,u=0;if(this.m_typeA===box2d.b2JointType.e_revoluteJoint)q.SetZero(),
k=t=1,u+=this.m_iA+this.m_iC,n=c-g-this.m_referenceAngleA;else{s=box2d.b2MulRV(n,this.m_localAxisC,box2d.b2GearJoint.prototype.SolvePositionConstraints.s_u);t=box2d.b2MulRV(n,this.m_lalcC,box2d.b2GearJoint.prototype.SolvePositionConstraints.s_rC);var v=box2d.b2MulRV(k,this.m_lalcA,box2d.b2GearJoint.prototype.SolvePositionConstraints.s_rA);q.Copy(s);k=box2d.b2CrossVV(t,s);t=box2d.b2CrossVV(v,s);u+=this.m_mC+this.m_mA+this.m_iC*k*k+this.m_iA*t*t;s=this.m_lalcC;n=box2d.b2MulTRV(n,box2d.b2AddVV(v,box2d.b2SubVV(b,
f,box2d.b2Vec2.s_t0),box2d.b2Vec2.s_t0),box2d.b2Vec2.s_t0);n=box2d.b2DotVV(box2d.b2SubVV(n,s,box2d.b2Vec2.s_t0),this.m_localAxisC)}if(this.m_typeB===box2d.b2JointType.e_revoluteJoint)r.SetZero(),m=s=this.m_ratio,u+=this.m_ratio*this.m_ratio*(this.m_iB+this.m_iD),p=d-l-this.m_referenceAngleB;else{s=box2d.b2MulRV(p,this.m_localAxisD,box2d.b2GearJoint.prototype.SolvePositionConstraints.s_u);var y=box2d.b2MulRV(p,this.m_lalcD,box2d.b2GearJoint.prototype.SolvePositionConstraints.s_rD),v=box2d.b2MulRV(m,
this.m_lalcB,box2d.b2GearJoint.prototype.SolvePositionConstraints.s_rB);box2d.b2MulSV(this.m_ratio,s,r);m=this.m_ratio*box2d.b2CrossVV(y,s);s=this.m_ratio*box2d.b2CrossVV(v,s);u+=this.m_ratio*this.m_ratio*(this.m_mD+this.m_mB)+this.m_iD*m*m+this.m_iB*s*s;y=this.m_lalcD;p=box2d.b2MulTRV(p,box2d.b2AddVV(v,box2d.b2SubVV(e,h,box2d.b2Vec2.s_t0),box2d.b2Vec2.s_t0),box2d.b2Vec2.s_t0);p=box2d.b2DotVV(box2d.b2SubVV(p,y,box2d.b2Vec2.s_t0),this.m_localAxisD)}p=n+this.m_ratio*p-this.m_constant;n=0;0<u&&(n=-p/
u);b.SelfMulAdd(this.m_mA*n,q);c+=this.m_iA*n*t;e.SelfMulAdd(this.m_mB*n,r);d+=this.m_iB*n*s;f.SelfMulSub(this.m_mC*n,q);g-=this.m_iC*n*k;h.SelfMulSub(this.m_mD*n,r);l-=this.m_iD*n*m;a.positions[this.m_indexA].a=c;a.positions[this.m_indexB].a=d;a.positions[this.m_indexC].a=g;a.positions[this.m_indexD].a=l;return 0<box2d.b2_linearSlop};goog.exportProperty(box2d.b2GearJoint.prototype,"SolvePositionConstraints",box2d.b2GearJoint.prototype.SolvePositionConstraints);
box2d.b2GearJoint.prototype.SolvePositionConstraints.s_u=new box2d.b2Vec2;box2d.b2GearJoint.prototype.SolvePositionConstraints.s_rA=new box2d.b2Vec2;box2d.b2GearJoint.prototype.SolvePositionConstraints.s_rB=new box2d.b2Vec2;box2d.b2GearJoint.prototype.SolvePositionConstraints.s_rC=new box2d.b2Vec2;box2d.b2GearJoint.prototype.SolvePositionConstraints.s_rD=new box2d.b2Vec2;box2d.b2GearJoint.prototype.GetAnchorA=function(a){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,a)};
goog.exportProperty(box2d.b2GearJoint.prototype,"GetAnchorA",box2d.b2GearJoint.prototype.GetAnchorA);box2d.b2GearJoint.prototype.GetAnchorB=function(a){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,a)};goog.exportProperty(box2d.b2GearJoint.prototype,"GetAnchorB",box2d.b2GearJoint.prototype.GetAnchorB);box2d.b2GearJoint.prototype.GetReactionForce=function(a,b){return box2d.b2MulSV(a*this.m_impulse,this.m_JvAC,b)};goog.exportProperty(box2d.b2GearJoint.prototype,"GetReactionForce",box2d.b2GearJoint.prototype.GetReactionForce);
box2d.b2GearJoint.prototype.GetReactionTorque=function(a){return a*this.m_impulse*this.m_JwA};goog.exportProperty(box2d.b2GearJoint.prototype,"GetReactionTorque",box2d.b2GearJoint.prototype.GetReactionTorque);box2d.b2GearJoint.prototype.GetJoint1=function(){return this.m_joint1};goog.exportProperty(box2d.b2GearJoint.prototype,"GetJoint1",box2d.b2GearJoint.prototype.GetJoint1);box2d.b2GearJoint.prototype.GetJoint2=function(){return this.m_joint2};
goog.exportProperty(box2d.b2GearJoint.prototype,"GetJoint2",box2d.b2GearJoint.prototype.GetJoint2);box2d.b2GearJoint.prototype.GetRatio=function(){return this.m_ratio};goog.exportProperty(box2d.b2GearJoint.prototype,"GetRatio",box2d.b2GearJoint.prototype.GetRatio);box2d.b2GearJoint.prototype.SetRatio=function(a){box2d.ENABLE_ASSERTS&&box2d.b2Assert(box2d.b2IsValid(a));this.m_ratio=a};goog.exportProperty(box2d.b2GearJoint.prototype,"SetRatio",box2d.b2GearJoint.prototype.SetRatio);
box2d.b2GearJoint.prototype.Dump=function(){if(box2d.DEBUG){var a=this.m_bodyA.m_islandIndex,b=this.m_bodyB.m_islandIndex,c=this.m_joint1.m_index,e=this.m_joint2.m_index;box2d.b2Log("  /*box2d.b2GearJointDef*/ var jd = new box2d.b2GearJointDef();\n");box2d.b2Log("  jd.bodyA = bodies[%d];\n",a);box2d.b2Log("  jd.bodyB = bodies[%d];\n",b);box2d.b2Log("  jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false");box2d.b2Log("  jd.joint1 = joints[%d];\n",c);box2d.b2Log("  jd.joint2 = joints[%d];\n",
e);box2d.b2Log("  jd.ratio = %.15f;\n",this.m_ratio);box2d.b2Log("  joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)}};goog.exportProperty(box2d.b2GearJoint.prototype,"Dump",box2d.b2GearJoint.prototype.Dump);box2d.b2DistanceProxy=function(){this.m_buffer=box2d.b2Vec2.MakeArray(2)};goog.exportSymbol("box2d.b2DistanceProxy",box2d.b2DistanceProxy);box2d.b2DistanceProxy.prototype.m_buffer=null;goog.exportProperty(box2d.b2DistanceProxy.prototype,"m_buffer",box2d.b2DistanceProxy.prototype.m_buffer);box2d.b2DistanceProxy.prototype.m_vertices=null;goog.exportProperty(box2d.b2DistanceProxy.prototype,"m_vertices",box2d.b2DistanceProxy.prototype.m_vertices);box2d.b2DistanceProxy.prototype.m_count=0;
goog.exportProperty(box2d.b2DistanceProxy.prototype,"m_count",box2d.b2DistanceProxy.prototype.m_count);box2d.b2DistanceProxy.prototype.m_radius=0;goog.exportProperty(box2d.b2DistanceProxy.prototype,"m_radius",box2d.b2DistanceProxy.prototype.m_radius);box2d.b2DistanceProxy.prototype.Reset=function(){this.m_vertices=null;this.m_radius=this.m_count=0;return this};goog.exportProperty(box2d.b2DistanceProxy.prototype,"Reset",box2d.b2DistanceProxy.prototype.Reset);
box2d.b2DistanceProxy.prototype.SetShape=function(a,b){a.SetupDistanceProxy(this,b)};goog.exportProperty(box2d.b2DistanceProxy.prototype,"SetShape",box2d.b2DistanceProxy.prototype.SetShape);box2d.b2DistanceProxy.prototype.GetSupport=function(a){for(var b=0,c=box2d.b2DotVV(this.m_vertices[0],a),e=1;e<this.m_count;++e){var d=box2d.b2DotVV(this.m_vertices[e],a);d>c&&(b=e,c=d)}return b};goog.exportProperty(box2d.b2DistanceProxy.prototype,"GetSupport",box2d.b2DistanceProxy.prototype.GetSupport);
box2d.b2DistanceProxy.prototype.GetSupportVertex=function(a,b){for(var c=0,e=box2d.b2DotVV(this.m_vertices[0],a),d=1;d<this.m_count;++d){var f=box2d.b2DotVV(this.m_vertices[d],a);f>e&&(c=d,e=f)}return b.Copy(this.m_vertices[c])};goog.exportProperty(box2d.b2DistanceProxy.prototype,"GetSupportVertex",box2d.b2DistanceProxy.prototype.GetSupportVertex);box2d.b2DistanceProxy.prototype.GetVertexCount=function(){return this.m_count};goog.exportProperty(box2d.b2DistanceProxy.prototype,"GetVertexCount",box2d.b2DistanceProxy.prototype.GetVertexCount);
box2d.b2DistanceProxy.prototype.GetVertex=function(a){box2d.ENABLE_ASSERTS&&box2d.b2Assert(0<=a&&a<this.m_count);return this.m_vertices[a]};goog.exportProperty(box2d.b2DistanceProxy.prototype,"GetVertex",box2d.b2DistanceProxy.prototype.GetVertex);box2d.b2SimplexCache=function(){this.indexA=box2d.b2MakeNumberArray(3);this.indexB=box2d.b2MakeNumberArray(3)};goog.exportSymbol("box2d.b2SimplexCache",box2d.b2SimplexCache);box2d.b2SimplexCache.prototype.metric=0;
goog.exportProperty(box2d.b2SimplexCache.prototype,"metric",box2d.b2SimplexCache.prototype.metric);box2d.b2SimplexCache.prototype.count=0;goog.exportProperty(box2d.b2SimplexCache.prototype,"count",box2d.b2SimplexCache.prototype.count);box2d.b2SimplexCache.prototype.indexA=null;goog.exportProperty(box2d.b2SimplexCache.prototype,"indexA",box2d.b2SimplexCache.prototype.indexA);box2d.b2SimplexCache.prototype.indexB=null;goog.exportProperty(box2d.b2SimplexCache.prototype,"indexB",box2d.b2SimplexCache.prototype.indexB);
box2d.b2SimplexCache.prototype.Reset=function(){this.count=this.metric=0;return this};goog.exportProperty(box2d.b2SimplexCache.prototype,"Reset",box2d.b2SimplexCache.prototype.Reset);box2d.b2DistanceInput=function(){this.proxyA=new box2d.b2DistanceProxy;this.proxyB=new box2d.b2DistanceProxy;this.transformA=new box2d.b2Transform;this.transformB=new box2d.b2Transform};goog.exportSymbol("box2d.b2DistanceInput",box2d.b2DistanceInput);box2d.b2DistanceInput.prototype.proxyA=null;
goog.exportProperty(box2d.b2DistanceInput.prototype,"proxyA",box2d.b2DistanceInput.prototype.proxyA);box2d.b2DistanceInput.prototype.proxyB=null;goog.exportProperty(box2d.b2DistanceInput.prototype,"proxyB",box2d.b2DistanceInput.prototype.proxyB);box2d.b2DistanceInput.prototype.transformA=null;goog.exportProperty(box2d.b2DistanceInput.prototype,"transformA",box2d.b2DistanceInput.prototype.transformA);box2d.b2DistanceInput.prototype.transformB=null;
goog.exportProperty(box2d.b2DistanceInput.prototype,"transformB",box2d.b2DistanceInput.prototype.transformB);box2d.b2DistanceInput.prototype.useRadii=!1;goog.exportProperty(box2d.b2DistanceInput.prototype,"useRadii",box2d.b2DistanceInput.prototype.useRadii);box2d.b2DistanceInput.prototype.Reset=function(){this.proxyA.Reset();this.proxyB.Reset();this.transformA.SetIdentity();this.transformB.SetIdentity();this.useRadii=!1;return this};goog.exportProperty(box2d.b2DistanceInput.prototype,"Reset",box2d.b2DistanceInput.prototype.Reset);
box2d.b2DistanceOutput=function(){this.pointA=new box2d.b2Vec2;this.pointB=new box2d.b2Vec2};goog.exportSymbol("box2d.b2DistanceOutput",box2d.b2DistanceOutput);box2d.b2DistanceOutput.prototype.pointA=null;goog.exportProperty(box2d.b2DistanceOutput.prototype,"pointA",box2d.b2DistanceOutput.prototype.pointA);box2d.b2DistanceOutput.prototype.pointB=null;goog.exportProperty(box2d.b2DistanceOutput.prototype,"pointB",box2d.b2DistanceOutput.prototype.pointB);box2d.b2DistanceOutput.prototype.distance=0;
goog.exportProperty(box2d.b2DistanceOutput.prototype,"distance",box2d.b2DistanceOutput.prototype.distance);box2d.b2DistanceOutput.prototype.iterations=0;goog.exportProperty(box2d.b2DistanceOutput.prototype,"iterations",box2d.b2DistanceOutput.prototype.iterations);box2d.b2DistanceOutput.prototype.Reset=function(){this.pointA.SetZero();this.pointB.SetZero();this.iterations=this.distance=0;return this};goog.exportProperty(box2d.b2DistanceOutput.prototype,"Reset",box2d.b2DistanceOutput.prototype.Reset);
box2d.b2_gjkCalls=0;goog.exportSymbol("box2d.b2_gjkCalls",box2d.b2_gjkCalls);box2d.b2_gjkIters=0;goog.exportSymbol("box2d.b2_gjkIters",box2d.b2_gjkIters);box2d.b2_gjkMaxIters=0;goog.exportSymbol("box2d.b2_gjkMaxIters",box2d.b2_gjkMaxIters);box2d.b2SimplexVertex=function(){this.wA=new box2d.b2Vec2;this.wB=new box2d.b2Vec2;this.w=new box2d.b2Vec2};goog.exportSymbol("box2d.b2SimplexVertex",box2d.b2SimplexVertex);box2d.b2SimplexVertex.prototype.wA=null;
goog.exportProperty(box2d.b2SimplexVertex.prototype,"wA",box2d.b2SimplexVertex.prototype.wA);box2d.b2SimplexVertex.prototype.wB=null;goog.exportProperty(box2d.b2SimplexVertex.prototype,"wB",box2d.b2SimplexVertex.prototype.wB);box2d.b2SimplexVertex.prototype.w=null;goog.exportProperty(box2d.b2SimplexVertex.prototype,"w",box2d.b2SimplexVertex.prototype.w);box2d.b2SimplexVertex.prototype.a=0;goog.exportProperty(box2d.b2SimplexVertex.prototype,"a",box2d.b2SimplexVertex.prototype.a);
box2d.b2SimplexVertex.prototype.indexA=0;goog.exportProperty(box2d.b2SimplexVertex.prototype,"indexA",box2d.b2SimplexVertex.prototype.indexA);box2d.b2SimplexVertex.prototype.indexB=0;goog.exportProperty(box2d.b2SimplexVertex.prototype,"indexB",box2d.b2SimplexVertex.prototype.indexB);box2d.b2SimplexVertex.prototype.Copy=function(a){this.wA.Copy(a.wA);this.wB.Copy(a.wB);this.w.Copy(a.w);this.a=a.a;this.indexA=a.indexA;this.indexB=a.indexB;return this};
goog.exportProperty(box2d.b2SimplexVertex.prototype,"Copy",box2d.b2SimplexVertex.prototype.Copy);box2d.b2Simplex=function(){this.m_v1=new box2d.b2SimplexVertex;this.m_v2=new box2d.b2SimplexVertex;this.m_v3=new box2d.b2SimplexVertex;this.m_vertices=Array(3);this.m_vertices[0]=this.m_v1;this.m_vertices[1]=this.m_v2;this.m_vertices[2]=this.m_v3};goog.exportSymbol("box2d.b2Simplex",box2d.b2Simplex);box2d.b2Simplex.prototype.m_v1=null;goog.exportProperty(box2d.b2Simplex.prototype,"m_v1",box2d.b2Simplex.prototype.m_v1);
box2d.b2Simplex.prototype.m_v2=null;goog.exportProperty(box2d.b2Simplex.prototype,"m_v2",box2d.b2Simplex.prototype.m_v2);box2d.b2Simplex.prototype.m_v3=null;goog.exportProperty(box2d.b2Simplex.prototype,"m_v3",box2d.b2Simplex.prototype.m_v3);box2d.b2Simplex.prototype.m_vertices=null;goog.exportProperty(box2d.b2Simplex.prototype,"m_vertices",box2d.b2Simplex.prototype.m_vertices);box2d.b2Simplex.prototype.m_count=0;goog.exportProperty(box2d.b2Simplex.prototype,"m_count",box2d.b2Simplex.prototype.m_count);
box2d.b2Simplex.prototype.ReadCache=function(a,b,c,e,d){box2d.ENABLE_ASSERTS&&box2d.b2Assert(0<=a.count&&3>=a.count);this.m_count=a.count;for(var f=this.m_vertices,g=0;g<this.m_count;++g){var h=f[g];h.indexA=a.indexA[g];h.indexB=a.indexB[g];var l=b.GetVertex(h.indexA),k=e.GetVertex(h.indexB);box2d.b2MulXV(c,l,h.wA);box2d.b2MulXV(d,k,h.wB);box2d.b2SubVV(h.wB,h.wA,h.w);h.a=0}1<this.m_count&&(a=a.metric,g=this.GetMetric(),g<0.5*a||2*a<g||g<box2d.b2_epsilon)&&(this.m_count=0);0===this.m_count&&(h=f[0],
h.indexA=0,h.indexB=0,l=b.GetVertex(0),k=e.GetVertex(0),box2d.b2MulXV(c,l,h.wA),box2d.b2MulXV(d,k,h.wB),box2d.b2SubVV(h.wB,h.wA,h.w),this.m_count=h.a=1)};goog.exportProperty(box2d.b2Simplex.prototype,"ReadCache",box2d.b2Simplex.prototype.ReadCache);box2d.b2Simplex.prototype.WriteCache=function(a){a.metric=this.GetMetric();a.count=this.m_count;for(var b=this.m_vertices,c=0;c<this.m_count;++c)a.indexA[c]=b[c].indexA,a.indexB[c]=b[c].indexB};
goog.exportProperty(box2d.b2Simplex.prototype,"WriteCache",box2d.b2Simplex.prototype.WriteCache);box2d.b2Simplex.prototype.GetSearchDirection=function(a){switch(this.m_count){case 1:return box2d.b2NegV(this.m_v1.w,a);case 2:var b=box2d.b2SubVV(this.m_v2.w,this.m_v1.w,a);return 0<box2d.b2CrossVV(b,box2d.b2NegV(this.m_v1.w,box2d.b2Vec2.s_t0))?box2d.b2CrossOneV(b,a):box2d.b2CrossVOne(b,a);default:return box2d.ENABLE_ASSERTS&&box2d.b2Assert(!1),a.SetZero()}};
goog.exportProperty(box2d.b2Simplex.prototype,"GetSearchDirection",box2d.b2Simplex.prototype.GetSearchDirection);box2d.b2Simplex.prototype.GetClosestPoint=function(a){switch(this.m_count){case 0:return box2d.ENABLE_ASSERTS&&box2d.b2Assert(!1),a.SetZero();case 1:return a.Copy(this.m_v1.w);case 2:return a.SetXY(this.m_v1.a*this.m_v1.w.x+this.m_v2.a*this.m_v2.w.x,this.m_v1.a*this.m_v1.w.y+this.m_v2.a*this.m_v2.w.y);case 3:return a.SetZero();default:return box2d.ENABLE_ASSERTS&&box2d.b2Assert(!1),a.SetZero()}};
goog.exportProperty(box2d.b2Simplex.prototype,"GetClosestPoint",box2d.b2Simplex.prototype.GetClosestPoint);
box2d.b2Simplex.prototype.GetWitnessPoints=function(a,b){switch(this.m_count){case 0:box2d.ENABLE_ASSERTS&&box2d.b2Assert(!1);break;case 1:a.Copy(this.m_v1.wA);b.Copy(this.m_v1.wB);break;case 2:a.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x;a.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y;b.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x;b.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3:b.x=a.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x+
this.m_v3.a*this.m_v3.wA.x;b.y=a.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y+this.m_v3.a*this.m_v3.wA.y;break;default:box2d.ENABLE_ASSERTS&&box2d.b2Assert(!1)}};goog.exportProperty(box2d.b2Simplex.prototype,"GetWitnessPoints",box2d.b2Simplex.prototype.GetWitnessPoints);
box2d.b2Simplex.prototype.GetMetric=function(){switch(this.m_count){case 0:return box2d.ENABLE_ASSERTS&&box2d.b2Assert(!1),0;case 1:return 0;case 2:return box2d.b2DistanceVV(this.m_v1.w,this.m_v2.w);case 3:return box2d.b2CrossVV(box2d.b2SubVV(this.m_v2.w,this.m_v1.w,box2d.b2Vec2.s_t0),box2d.b2SubVV(this.m_v3.w,this.m_v1.w,box2d.b2Vec2.s_t1));default:return box2d.ENABLE_ASSERTS&&box2d.b2Assert(!1),0}};goog.exportProperty(box2d.b2Simplex.prototype,"GetMetric",box2d.b2Simplex.prototype.GetMetric);
box2d.b2Simplex.prototype.Solve2=function(){var a=this.m_v1.w,b=this.m_v2.w,c=box2d.b2SubVV(b,a,box2d.b2Simplex.s_e12),a=-box2d.b2DotVV(a,c);0>=a?this.m_count=this.m_v1.a=1:(b=box2d.b2DotVV(b,c),0>=b?(this.m_count=this.m_v2.a=1,this.m_v1.Copy(this.m_v2)):(c=1/(b+a),this.m_v1.a=b*c,this.m_v2.a=a*c,this.m_count=2))};goog.exportProperty(box2d.b2Simplex.prototype,"Solve2",box2d.b2Simplex.prototype.Solve2);
box2d.b2Simplex.prototype.Solve3=function(){var a=this.m_v1.w,b=this.m_v2.w,c=this.m_v3.w,e=box2d.b2SubVV(b,a,box2d.b2Simplex.s_e12),d=box2d.b2DotVV(a,e),f=box2d.b2DotVV(b,e),d=-d,g=box2d.b2SubVV(c,a,box2d.b2Simplex.s_e13),h=box2d.b2DotVV(a,g),l=box2d.b2DotVV(c,g),h=-h,k=box2d.b2SubVV(c,b,box2d.b2Simplex.s_e23),m=box2d.b2DotVV(b,k),k=box2d.b2DotVV(c,k),m=-m,g=box2d.b2CrossVV(e,g),e=g*box2d.b2CrossVV(b,c),c=g*box2d.b2CrossVV(c,a),a=g*box2d.b2CrossVV(a,b);0>=d&&0>=h?this.m_count=this.m_v1.a=1:0<f&&
0<d&&0>=a?(l=1/(f+d),this.m_v1.a=f*l,this.m_v2.a=d*l,this.m_count=2):0<l&&0<h&&0>=c?(f=1/(l+h),this.m_v1.a=l*f,this.m_v3.a=h*f,this.m_count=2,this.m_v2.Copy(this.m_v3)):0>=f&&0>=m?(this.m_count=this.m_v2.a=1,this.m_v1.Copy(this.m_v2)):0>=l&&0>=k?(this.m_count=this.m_v3.a=1,this.m_v1.Copy(this.m_v3)):0<k&&0<m&&0>=e?(f=1/(k+m),this.m_v2.a=k*f,this.m_v3.a=m*f,this.m_count=2,this.m_v1.Copy(this.m_v3)):(f=1/(e+c+a),this.m_v1.a=e*f,this.m_v2.a=c*f,this.m_v3.a=a*f,this.m_count=3)};
goog.exportProperty(box2d.b2Simplex.prototype,"Solve3",box2d.b2Simplex.prototype.Solve3);box2d.b2Simplex.s_e12=new box2d.b2Vec2;box2d.b2Simplex.s_e13=new box2d.b2Vec2;box2d.b2Simplex.s_e23=new box2d.b2Vec2;
box2d.b2Distance=function(a,b,c){++box2d.b2_gjkCalls;var e=c.proxyA,d=c.proxyB,f=c.transformA,g=c.transformB,h=box2d.b2Distance.s_simplex;h.ReadCache(b,e,f,d,g);for(var l=h.m_vertices,k=box2d.b2Distance.s_saveA,m=box2d.b2Distance.s_saveB,n=0,p=0;20>p;){for(var n=h.m_count,q=0;q<n;++q)k[q]=l[q].indexA,m[q]=l[q].indexB;switch(h.m_count){case 1:break;case 2:h.Solve2();break;case 3:h.Solve3();break;default:box2d.ENABLE_ASSERTS&&box2d.b2Assert(!1)}if(3===h.m_count)break;var r=h.GetClosestPoint(box2d.b2Distance.s_p);
r.GetLengthSquared();q=h.GetSearchDirection(box2d.b2Distance.s_d);if(q.GetLengthSquared()<box2d.b2_epsilon_sq)break;r=l[h.m_count];r.indexA=e.GetSupport(box2d.b2MulTRV(f.q,box2d.b2NegV(q,box2d.b2Vec2.s_t0),box2d.b2Distance.s_supportA));box2d.b2MulXV(f,e.GetVertex(r.indexA),r.wA);r.indexB=d.GetSupport(box2d.b2MulTRV(g.q,q,box2d.b2Distance.s_supportB));box2d.b2MulXV(g,d.GetVertex(r.indexB),r.wB);box2d.b2SubVV(r.wB,r.wA,r.w);++p;++box2d.b2_gjkIters;for(var t=!1,q=0;q<n;++q)if(r.indexA===k[q]&&r.indexB===
m[q]){t=!0;break}if(t)break;++h.m_count}box2d.b2_gjkMaxIters=box2d.b2Max(box2d.b2_gjkMaxIters,p);h.GetWitnessPoints(a.pointA,a.pointB);a.distance=box2d.b2DistanceVV(a.pointA,a.pointB);a.iterations=p;h.WriteCache(b);c.useRadii&&(b=e.m_radius,d=d.m_radius,a.distance>b+d&&a.distance>box2d.b2_epsilon?(a.distance-=b+d,c=box2d.b2SubVV(a.pointB,a.pointA,box2d.b2Distance.s_normal),c.Normalize(),a.pointA.SelfMulAdd(b,c),a.pointB.SelfMulSub(d,c)):(r=box2d.b2MidVV(a.pointA,a.pointB,box2d.b2Distance.s_p),a.pointA.Copy(r),
a.pointB.Copy(r),a.distance=0))};goog.exportSymbol("box2d.b2Distance",box2d.b2Distance);box2d.b2Distance.s_simplex=new box2d.b2Simplex;box2d.b2Distance.s_saveA=box2d.b2MakeNumberArray(3);box2d.b2Distance.s_saveB=box2d.b2MakeNumberArray(3);box2d.b2Distance.s_p=new box2d.b2Vec2;box2d.b2Distance.s_d=new box2d.b2Vec2;box2d.b2Distance.s_normal=new box2d.b2Vec2;box2d.b2Distance.s_supportA=new box2d.b2Vec2;box2d.b2Distance.s_supportB=new box2d.b2Vec2;box2d.b2WeldJointDef=function(){box2d.b2JointDef.call(this,box2d.b2JointType.e_weldJoint);this.localAnchorA=new box2d.b2Vec2;this.localAnchorB=new box2d.b2Vec2};goog.inherits(box2d.b2WeldJointDef,box2d.b2JointDef);goog.exportSymbol("box2d.b2WeldJointDef",box2d.b2WeldJointDef);box2d.b2WeldJointDef.prototype.localAnchorA=null;goog.exportProperty(box2d.b2WeldJointDef.prototype,"localAnchorA",box2d.b2WeldJointDef.prototype.localAnchorA);box2d.b2WeldJointDef.prototype.localAnchorB=null;
goog.exportProperty(box2d.b2WeldJointDef.prototype,"localAnchorB",box2d.b2WeldJointDef.prototype.localAnchorB);box2d.b2WeldJointDef.prototype.referenceAngle=0;goog.exportProperty(box2d.b2WeldJointDef.prototype,"referenceAngle",box2d.b2WeldJointDef.prototype.referenceAngle);box2d.b2WeldJointDef.prototype.frequencyHz=0;goog.exportProperty(box2d.b2WeldJointDef.prototype,"frequencyHz",box2d.b2WeldJointDef.prototype.frequencyHz);box2d.b2WeldJointDef.prototype.dampingRatio=0;
goog.exportProperty(box2d.b2WeldJointDef.prototype,"dampingRatio",box2d.b2WeldJointDef.prototype.dampingRatio);box2d.b2WeldJointDef.prototype.Initialize=function(a,b,c){this.bodyA=a;this.bodyB=b;this.bodyA.GetLocalPoint(c,this.localAnchorA);this.bodyB.GetLocalPoint(c,this.localAnchorB);this.referenceAngle=this.bodyB.GetAngleRadians()-this.bodyA.GetAngleRadians()};goog.exportProperty(box2d.b2WeldJointDef.prototype,"Initialize",box2d.b2WeldJointDef.prototype.Initialize);
box2d.b2WeldJoint=function(a){box2d.b2Joint.call(this,a);this.m_frequencyHz=a.frequencyHz;this.m_dampingRatio=a.dampingRatio;this.m_localAnchorA=a.localAnchorA.Clone();this.m_localAnchorB=a.localAnchorB.Clone();this.m_referenceAngle=a.referenceAngle;this.m_impulse=new box2d.b2Vec3(0,0,0);this.m_rA=new box2d.b2Vec2;this.m_rB=new box2d.b2Vec2;this.m_localCenterA=new box2d.b2Vec2;this.m_localCenterB=new box2d.b2Vec2;this.m_mass=new box2d.b2Mat33;this.m_qA=new box2d.b2Rot;this.m_qB=new box2d.b2Rot;this.m_lalcA=
new box2d.b2Vec2;this.m_lalcB=new box2d.b2Vec2;this.m_K=new box2d.b2Mat33};goog.inherits(box2d.b2WeldJoint,box2d.b2Joint);goog.exportSymbol("box2d.b2WeldJoint",box2d.b2WeldJoint);box2d.b2WeldJoint.prototype.m_frequencyHz=0;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_frequencyHz",box2d.b2WeldJoint.prototype.m_frequencyHz);box2d.b2WeldJoint.prototype.m_dampingRatio=0;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_dampingRatio",box2d.b2WeldJoint.prototype.m_dampingRatio);
box2d.b2WeldJoint.prototype.m_bias=0;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_bias",box2d.b2WeldJoint.prototype.m_bias);box2d.b2WeldJoint.prototype.m_localAnchorA=null;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_localAnchorA",box2d.b2WeldJoint.prototype.m_localAnchorA);box2d.b2WeldJoint.prototype.m_localAnchorB=null;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_localAnchorB",box2d.b2WeldJoint.prototype.m_localAnchorB);box2d.b2WeldJoint.prototype.m_referenceAngle=0;
goog.exportProperty(box2d.b2WeldJoint.prototype,"m_referenceAngle",box2d.b2WeldJoint.prototype.m_referenceAngle);box2d.b2WeldJoint.prototype.m_gamma=0;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_gamma",box2d.b2WeldJoint.prototype.m_gamma);box2d.b2WeldJoint.prototype.m_impulse=null;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_impulse",box2d.b2WeldJoint.prototype.m_impulse);box2d.b2WeldJoint.prototype.m_indexA=0;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_indexA",box2d.b2WeldJoint.prototype.m_indexA);
box2d.b2WeldJoint.prototype.m_indexB=0;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_indexB",box2d.b2WeldJoint.prototype.m_indexB);box2d.b2WeldJoint.prototype.m_rA=null;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_rA",box2d.b2WeldJoint.prototype.m_rA);box2d.b2WeldJoint.prototype.m_rB=null;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_rB",box2d.b2WeldJoint.prototype.m_rB);box2d.b2WeldJoint.prototype.m_localCenterA=null;
goog.exportProperty(box2d.b2WeldJoint.prototype,"m_localCenterA",box2d.b2WeldJoint.prototype.m_localCenterA);box2d.b2WeldJoint.prototype.m_localCenterB=null;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_localCenterB",box2d.b2WeldJoint.prototype.m_localCenterB);box2d.b2WeldJoint.prototype.m_invMassA=0;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_invMassA",box2d.b2WeldJoint.prototype.m_invMassA);box2d.b2WeldJoint.prototype.m_invMassB=0;
goog.exportProperty(box2d.b2WeldJoint.prototype,"m_invMassB",box2d.b2WeldJoint.prototype.m_invMassB);box2d.b2WeldJoint.prototype.m_invIA=0;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_invIA",box2d.b2WeldJoint.prototype.m_invIA);box2d.b2WeldJoint.prototype.m_invIB=0;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_invIB",box2d.b2WeldJoint.prototype.m_invIB);box2d.b2WeldJoint.prototype.m_mass=null;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_mass",box2d.b2WeldJoint.prototype.m_mass);
box2d.b2WeldJoint.prototype.m_qA=null;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_qA",box2d.b2WeldJoint.prototype.m_qA);box2d.b2WeldJoint.prototype.m_qB=null;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_qB",box2d.b2WeldJoint.prototype.m_qB);box2d.b2WeldJoint.prototype.m_lalcA=null;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_lalcA",box2d.b2WeldJoint.prototype.m_lalcA);box2d.b2WeldJoint.prototype.m_lalcB=null;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_lalcB",box2d.b2WeldJoint.prototype.m_lalcB);
box2d.b2WeldJoint.prototype.m_K=null;goog.exportProperty(box2d.b2WeldJoint.prototype,"m_K",box2d.b2WeldJoint.prototype.m_K);
box2d.b2WeldJoint.prototype.InitVelocityConstraints=function(a){this.m_indexA=this.m_bodyA.m_islandIndex;this.m_indexB=this.m_bodyB.m_islandIndex;this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);this.m_invMassA=this.m_bodyA.m_invMass;this.m_invMassB=this.m_bodyB.m_invMass;this.m_invIA=this.m_bodyA.m_invI;this.m_invIB=this.m_bodyB.m_invI;var b=a.positions[this.m_indexA].a,c=a.velocities[this.m_indexA].v,e=a.velocities[this.m_indexA].w,
d=a.positions[this.m_indexB].a,f=a.velocities[this.m_indexB].v,g=a.velocities[this.m_indexB].w,h=this.m_qA.SetAngleRadians(b),l=this.m_qB.SetAngleRadians(d);box2d.b2SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);box2d.b2MulRV(h,this.m_lalcA,this.m_rA);box2d.b2SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);box2d.b2MulRV(l,this.m_lalcB,this.m_rB);var h=this.m_invMassA,l=this.m_invMassB,k=this.m_invIA,m=this.m_invIB,n=this.m_K;n.ex.x=h+l+this.m_rA.y*this.m_rA.y*k+this.m_rB.y*
this.m_rB.y*m;n.ey.x=-this.m_rA.y*this.m_rA.x*k-this.m_rB.y*this.m_rB.x*m;n.ez.x=-this.m_rA.y*k-this.m_rB.y*m;n.ex.y=n.ey.x;n.ey.y=h+l+this.m_rA.x*this.m_rA.x*k+this.m_rB.x*this.m_rB.x*m;n.ez.y=this.m_rA.x*k+this.m_rB.x*m;n.ex.z=n.ez.x;n.ey.z=n.ez.y;n.ez.z=k+m;if(0<this.m_frequencyHz){n.GetInverse22(this.m_mass);var n=k+m,p=0<n?1/n:0,b=d-b-this.m_referenceAngle,d=2*box2d.b2_pi*this.m_frequencyHz,q=p*d*d,r=a.step.dt;this.m_gamma=r*(2*p*this.m_dampingRatio*d+r*q);this.m_gamma=0!==this.m_gamma?1/this.m_gamma:
0;this.m_bias=b*r*q*this.m_gamma;n+=this.m_gamma;this.m_mass.ez.z=0!==n?1/n:0}else n.GetSymInverse33(this.m_mass),this.m_bias=this.m_gamma=0;a.step.warmStarting?(this.m_impulse.SelfMul(a.step.dtRatio),n=box2d.b2WeldJoint.prototype.InitVelocityConstraints.s_P.SetXY(this.m_impulse.x,this.m_impulse.y),c.SelfMulSub(h,n),e-=k*(box2d.b2CrossVV(this.m_rA,n)+this.m_impulse.z),f.SelfMulAdd(l,n),g+=m*(box2d.b2CrossVV(this.m_rB,n)+this.m_impulse.z)):this.m_impulse.SetZero();a.velocities[this.m_indexA].w=e;a.velocities[this.m_indexB].w=
g};box2d.b2WeldJoint.prototype.InitVelocityConstraints.s_P=new box2d.b2Vec2;
box2d.b2WeldJoint.prototype.SolveVelocityConstraints=function(a){var b=a.velocities[this.m_indexA].v,c=a.velocities[this.m_indexA].w,e=a.velocities[this.m_indexB].v,d=a.velocities[this.m_indexB].w,f=this.m_invMassA,g=this.m_invMassB,h=this.m_invIA,l=this.m_invIB;if(0<this.m_frequencyHz){var k=-this.m_mass.ez.z*(d-c+this.m_bias+this.m_gamma*this.m_impulse.z);this.m_impulse.z+=k;c-=h*k;d+=l*k;k=box2d.b2SubVV(box2d.b2AddVCrossSV(e,d,this.m_rB,box2d.b2Vec2.s_t0),box2d.b2AddVCrossSV(b,c,this.m_rA,box2d.b2Vec2.s_t1),
box2d.b2WeldJoint.prototype.SolveVelocityConstraints.s_Cdot1);k=box2d.b2MulM33XY(this.m_mass,k.x,k.y,box2d.b2WeldJoint.prototype.SolveVelocityConstraints.s_impulse1).SelfNeg();this.m_impulse.x+=k.x;this.m_impulse.y+=k.y;b.SelfMulSub(f,k);c-=h*box2d.b2CrossVV(this.m_rA,k);e.SelfMulAdd(g,k);d+=l*box2d.b2CrossVV(this.m_rB,k)}else{var k=box2d.b2SubVV(box2d.b2AddVCrossSV(e,d,this.m_rB,box2d.b2Vec2.s_t0),box2d.b2AddVCrossSV(b,c,this.m_rA,box2d.b2Vec2.s_t1),box2d.b2WeldJoint.prototype.SolveVelocityConstraints.s_Cdot1),
m=box2d.b2MulM33XYZ(this.m_mass,k.x,k.y,d-c,box2d.b2WeldJoint.prototype.SolveVelocityConstraints.s_impulse).SelfNeg();this.m_impulse.SelfAdd(m);k=box2d.b2WeldJoint.prototype.SolveVelocityConstraints.s_P.SetXY(m.x,m.y);b.SelfMulSub(f,k);c-=h*(box2d.b2CrossVV(this.m_rA,k)+m.z);e.SelfMulAdd(g,k);d+=l*(box2d.b2CrossVV(this.m_rB,k)+m.z)}a.velocities[this.m_indexA].w=c;a.velocities[this.m_indexB].w=d};goog.exportProperty(box2d.b2WeldJoint.prototype,"SolveVelocityConstraints",box2d.b2WeldJoint.prototype.SolveVelocityConstraints);
box2d.b2WeldJoint.prototype.SolveVelocityConstraints.s_Cdot1=new box2d.b2Vec2;box2d.b2WeldJoint.prototype.SolveVelocityConstraints.s_impulse1=new box2d.b2Vec2;box2d.b2WeldJoint.prototype.SolveVelocityConstraints.s_impulse=new box2d.b2Vec3;box2d.b2WeldJoint.prototype.SolveVelocityConstraints.s_P=new box2d.b2Vec2;
box2d.b2WeldJoint.prototype.SolvePositionConstraints=function(a){var b=a.positions[this.m_indexA].c,c=a.positions[this.m_indexA].a,e=a.positions[this.m_indexB].c,d=a.positions[this.m_indexB].a,f=this.m_qA.SetAngleRadians(c),g=this.m_qB.SetAngleRadians(d),h=this.m_invMassA,l=this.m_invMassB,k=this.m_invIA,m=this.m_invIB;box2d.b2SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);var n=box2d.b2MulRV(f,this.m_lalcA,this.m_rA);box2d.b2SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);
var p=box2d.b2MulRV(g,this.m_lalcB,this.m_rB),q=this.m_K;q.ex.x=h+l+n.y*n.y*k+p.y*p.y*m;q.ey.x=-n.y*n.x*k-p.y*p.x*m;q.ez.x=-n.y*k-p.y*m;q.ex.y=q.ey.x;q.ey.y=h+l+n.x*n.x*k+p.x*p.x*m;q.ez.y=n.x*k+p.x*m;q.ex.z=q.ez.x;q.ey.z=q.ez.y;q.ez.z=k+m;if(0<this.m_frequencyHz){var r=box2d.b2SubVV(box2d.b2AddVV(e,p,box2d.b2Vec2.s_t0),box2d.b2AddVV(b,n,box2d.b2Vec2.s_t1),box2d.b2WeldJoint.prototype.SolvePositionConstraints.s_C1),g=r.GetLength(),f=0,q=q.Solve22(r.x,r.y,box2d.b2WeldJoint.prototype.SolvePositionConstraints.s_P).SelfNeg();
b.SelfMulSub(h,q);c-=k*box2d.b2CrossVV(n,q);e.SelfMulAdd(l,q);d+=m*box2d.b2CrossVV(p,q)}else r=box2d.b2SubVV(box2d.b2AddVV(e,p,box2d.b2Vec2.s_t0),box2d.b2AddVV(b,n,box2d.b2Vec2.s_t1),box2d.b2WeldJoint.prototype.SolvePositionConstraints.s_C1),n=d-c-this.m_referenceAngle,g=r.GetLength(),f=box2d.b2Abs(n),n=q.Solve33(r.x,r.y,n,box2d.b2WeldJoint.prototype.SolvePositionConstraints.s_impulse).SelfNeg(),q=box2d.b2WeldJoint.prototype.SolvePositionConstraints.s_P.SetXY(n.x,n.y),b.SelfMulSub(h,q),c-=k*(box2d.b2CrossVV(this.m_rA,
q)+n.z),e.SelfMulAdd(l,q),d+=m*(box2d.b2CrossVV(this.m_rB,q)+n.z);a.positions[this.m_indexA].a=c;a.positions[this.m_indexB].a=d;return g<=box2d.b2_linearSlop&&f<=box2d.b2_angularSlop};goog.exportProperty(box2d.b2WeldJoint.prototype,"SolvePositionConstraints",box2d.b2WeldJoint.prototype.SolvePositionConstraints);box2d.b2WeldJoint.prototype.SolvePositionConstraints.s_C1=new box2d.b2Vec2;box2d.b2WeldJoint.prototype.SolvePositionConstraints.s_P=new box2d.b2Vec2;
box2d.b2WeldJoint.prototype.SolvePositionConstraints.s_impulse=new box2d.b2Vec3;box2d.b2WeldJoint.prototype.GetAnchorA=function(a){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,a)};goog.exportProperty(box2d.b2WeldJoint.prototype,"GetAnchorA",box2d.b2WeldJoint.prototype.GetAnchorA);box2d.b2WeldJoint.prototype.GetAnchorB=function(a){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,a)};goog.exportProperty(box2d.b2WeldJoint.prototype,"GetAnchorB",box2d.b2WeldJoint.prototype.GetAnchorB);
box2d.b2WeldJoint.prototype.GetReactionForce=function(a,b){return b.SetXY(a*this.m_impulse.x,a*this.m_impulse.y)};goog.exportProperty(box2d.b2WeldJoint.prototype,"GetReactionForce",box2d.b2WeldJoint.prototype.GetReactionForce);box2d.b2WeldJoint.prototype.GetReactionTorque=function(a){return a*this.m_impulse.z};goog.exportProperty(box2d.b2WeldJoint.prototype,"GetReactionTorque",box2d.b2WeldJoint.prototype.GetReactionTorque);box2d.b2WeldJoint.prototype.GetLocalAnchorA=function(a){return a.Copy(this.m_localAnchorA)};
goog.exportProperty(box2d.b2WeldJoint.prototype,"GetLocalAnchorA",box2d.b2WeldJoint.prototype.GetLocalAnchorA);box2d.b2WeldJoint.prototype.GetLocalAnchorB=function(a){return a.Copy(this.m_localAnchorB)};goog.exportProperty(box2d.b2WeldJoint.prototype,"GetLocalAnchorB",box2d.b2WeldJoint.prototype.GetLocalAnchorB);box2d.b2WeldJoint.prototype.GetReferenceAngle=function(){return this.m_referenceAngle};goog.exportProperty(box2d.b2WeldJoint.prototype,"GetReferenceAngle",box2d.b2WeldJoint.prototype.GetReferenceAngle);
box2d.b2WeldJoint.prototype.SetFrequency=function(a){this.m_frequencyHz=a};box2d.b2WeldJoint.prototype.GetFrequency=function(){return this.m_frequencyHz};goog.exportProperty(box2d.b2WeldJoint.prototype,"GetFrequency",box2d.b2WeldJoint.prototype.GetFrequency);box2d.b2WeldJoint.prototype.SetDampingRatio=function(a){this.m_dampingRatio=a};box2d.b2WeldJoint.prototype.GetDampingRatio=function(){return this.m_dampingRatio};goog.exportProperty(box2d.b2WeldJoint.prototype,"GetDampingRatio",box2d.b2WeldJoint.prototype.GetDampingRatio);
box2d.b2WeldJoint.prototype.Dump=function(){if(box2d.DEBUG){var a=this.m_bodyA.m_islandIndex,b=this.m_bodyB.m_islandIndex;box2d.b2Log("  /*box2d.b2WeldJointDef*/ var jd = new box2d.b2WeldJointDef();\n");box2d.b2Log("  jd.bodyA = bodies[%d];\n",a);box2d.b2Log("  jd.bodyB = bodies[%d];\n",b);box2d.b2Log("  jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false");box2d.b2Log("  jd.localAnchorA.SetXY(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y);box2d.b2Log("  jd.localAnchorB.SetXY(%.15f, %.15f);\n",
this.m_localAnchorB.x,this.m_localAnchorB.y);box2d.b2Log("  jd.referenceAngle = %.15f;\n",this.m_referenceAngle);box2d.b2Log("  jd.frequencyHz = %.15f;\n",this.m_frequencyHz);box2d.b2Log("  jd.dampingRatio = %.15f;\n",this.m_dampingRatio);box2d.b2Log("  joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)}};goog.exportProperty(box2d.b2WeldJoint.prototype,"Dump",box2d.b2WeldJoint.prototype.Dump);box2d.b2RopeJointDef=function(){box2d.b2JointDef.call(this,box2d.b2JointType.e_ropeJoint);this.localAnchorA=new box2d.b2Vec2(-1,0);this.localAnchorB=new box2d.b2Vec2(1,0)};goog.inherits(box2d.b2RopeJointDef,box2d.b2JointDef);goog.exportSymbol("box2d.b2RopeJointDef",box2d.b2RopeJointDef);box2d.b2RopeJointDef.prototype.localAnchorA=null;goog.exportProperty(box2d.b2RopeJointDef.prototype,"localAnchorA",box2d.b2RopeJointDef.prototype.localAnchorA);box2d.b2RopeJointDef.prototype.localAnchorB=null;
goog.exportProperty(box2d.b2RopeJointDef.prototype,"localAnchorB",box2d.b2RopeJointDef.prototype.localAnchorB);box2d.b2RopeJointDef.prototype.maxLength=0;goog.exportProperty(box2d.b2RopeJointDef.prototype,"maxLength",box2d.b2RopeJointDef.prototype.maxLength);
box2d.b2RopeJoint=function(a){box2d.b2Joint.call(this,a);this.m_localAnchorA=a.localAnchorA.Clone();this.m_localAnchorB=a.localAnchorB.Clone();this.m_maxLength=a.maxLength;this.m_u=new box2d.b2Vec2;this.m_rA=new box2d.b2Vec2;this.m_rB=new box2d.b2Vec2;this.m_localCenterA=new box2d.b2Vec2;this.m_localCenterB=new box2d.b2Vec2;this.m_qA=new box2d.b2Rot;this.m_qB=new box2d.b2Rot;this.m_lalcA=new box2d.b2Vec2;this.m_lalcB=new box2d.b2Vec2};goog.inherits(box2d.b2RopeJoint,box2d.b2Joint);
goog.exportSymbol("box2d.b2RopeJoint",box2d.b2RopeJoint);box2d.b2RopeJoint.prototype.m_localAnchorA=null;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_localAnchorA",box2d.b2RopeJoint.prototype.m_localAnchorA);box2d.b2RopeJoint.prototype.m_localAnchorB=null;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_localAnchorB",box2d.b2RopeJoint.prototype.m_localAnchorB);box2d.b2RopeJoint.prototype.m_maxLength=0;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_maxLength",box2d.b2RopeJoint.prototype.m_maxLength);
box2d.b2RopeJoint.prototype.m_length=0;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_length",box2d.b2RopeJoint.prototype.m_length);box2d.b2RopeJoint.prototype.m_impulse=0;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_impulse",box2d.b2RopeJoint.prototype.m_impulse);box2d.b2RopeJoint.prototype.m_indexA=0;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_indexA",box2d.b2RopeJoint.prototype.m_indexA);box2d.b2RopeJoint.prototype.m_indexB=0;
goog.exportProperty(box2d.b2RopeJoint.prototype,"m_indexB",box2d.b2RopeJoint.prototype.m_indexB);box2d.b2RopeJoint.prototype.m_u=null;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_u",box2d.b2RopeJoint.prototype.m_u);box2d.b2RopeJoint.prototype.m_rA=null;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_rA",box2d.b2RopeJoint.prototype.m_rA);box2d.b2RopeJoint.prototype.m_rB=null;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_rB",box2d.b2RopeJoint.prototype.m_rB);
box2d.b2RopeJoint.prototype.m_localCenterA=null;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_localCenterA",box2d.b2RopeJoint.prototype.m_localCenterA);box2d.b2RopeJoint.prototype.m_localCenterB=null;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_localCenterB",box2d.b2RopeJoint.prototype.m_localCenterB);box2d.b2RopeJoint.prototype.m_invMassA=0;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_invMassA",box2d.b2RopeJoint.prototype.m_invMassA);box2d.b2RopeJoint.prototype.m_invMassB=0;
goog.exportProperty(box2d.b2RopeJoint.prototype,"m_invMassB",box2d.b2RopeJoint.prototype.m_invMassB);box2d.b2RopeJoint.prototype.m_invIA=0;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_invIA",box2d.b2RopeJoint.prototype.m_invIA);box2d.b2RopeJoint.prototype.m_invIB=0;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_invIB",box2d.b2RopeJoint.prototype.m_invIB);box2d.b2RopeJoint.prototype.m_mass=0;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_mass",box2d.b2RopeJoint.prototype.m_mass);
box2d.b2RopeJoint.prototype.m_state=box2d.b2LimitState.e_inactiveLimit;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_state",box2d.b2RopeJoint.prototype.m_state);box2d.b2RopeJoint.prototype.m_qA=null;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_qA",box2d.b2RopeJoint.prototype.m_qA);box2d.b2RopeJoint.prototype.m_qB=null;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_qB",box2d.b2RopeJoint.prototype.m_qB);box2d.b2RopeJoint.prototype.m_lalcA=null;
goog.exportProperty(box2d.b2RopeJoint.prototype,"m_lalcA",box2d.b2RopeJoint.prototype.m_lalcA);box2d.b2RopeJoint.prototype.m_lalcB=null;goog.exportProperty(box2d.b2RopeJoint.prototype,"m_lalcB",box2d.b2RopeJoint.prototype.m_lalcB);
box2d.b2RopeJoint.prototype.InitVelocityConstraints=function(a){this.m_indexA=this.m_bodyA.m_islandIndex;this.m_indexB=this.m_bodyB.m_islandIndex;this.m_localCenterA.Copy(this.m_bodyA.m_sweep.localCenter);this.m_localCenterB.Copy(this.m_bodyB.m_sweep.localCenter);this.m_invMassA=this.m_bodyA.m_invMass;this.m_invMassB=this.m_bodyB.m_invMass;this.m_invIA=this.m_bodyA.m_invI;this.m_invIB=this.m_bodyB.m_invI;var b=a.positions[this.m_indexA].c,c=a.velocities[this.m_indexA].v,e=a.velocities[this.m_indexA].w,
d=a.positions[this.m_indexB].c,f=a.positions[this.m_indexB].a,g=a.velocities[this.m_indexB].v,h=a.velocities[this.m_indexB].w,l=this.m_qA.SetAngleRadians(a.positions[this.m_indexA].a),f=this.m_qB.SetAngleRadians(f);box2d.b2SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);box2d.b2MulRV(l,this.m_lalcA,this.m_rA);box2d.b2SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);box2d.b2MulRV(f,this.m_lalcB,this.m_rB);this.m_u.Copy(d).SelfAdd(this.m_rB).SelfSub(b).SelfSub(this.m_rA);this.m_length=
this.m_u.GetLength();this.m_state=0<this.m_length-this.m_maxLength?box2d.b2LimitState.e_atUpperLimit:box2d.b2LimitState.e_inactiveLimit;this.m_length>box2d.b2_linearSlop?(this.m_u.SelfMul(1/this.m_length),b=box2d.b2CrossVV(this.m_rA,this.m_u),d=box2d.b2CrossVV(this.m_rB,this.m_u),b=this.m_invMassA+this.m_invIA*b*b+this.m_invMassB+this.m_invIB*d*d,this.m_mass=0!==b?1/b:0,a.step.warmStarting?(this.m_impulse*=a.step.dtRatio,b=box2d.b2MulSV(this.m_impulse,this.m_u,box2d.b2RopeJoint.prototype.InitVelocityConstraints.s_P),
c.SelfMulSub(this.m_invMassA,b),e-=this.m_invIA*box2d.b2CrossVV(this.m_rA,b),g.SelfMulAdd(this.m_invMassB,b),h+=this.m_invIB*box2d.b2CrossVV(this.m_rB,b)):this.m_impulse=0,a.velocities[this.m_indexA].w=e,a.velocities[this.m_indexB].w=h):(this.m_u.SetZero(),this.m_impulse=this.m_mass=0)};goog.exportProperty(box2d.b2RopeJoint.prototype,"InitVelocityConstraints",box2d.b2RopeJoint.prototype.InitVelocityConstraints);box2d.b2RopeJoint.prototype.InitVelocityConstraints.s_P=new box2d.b2Vec2;
box2d.b2RopeJoint.prototype.SolveVelocityConstraints=function(a){var b=a.velocities[this.m_indexA].v,c=a.velocities[this.m_indexA].w,e=a.velocities[this.m_indexB].v,d=a.velocities[this.m_indexB].w,f=box2d.b2AddVCrossSV(b,c,this.m_rA,box2d.b2RopeJoint.prototype.SolveVelocityConstraints.s_vpA),g=box2d.b2AddVCrossSV(e,d,this.m_rB,box2d.b2RopeJoint.prototype.SolveVelocityConstraints.s_vpB),h=this.m_length-this.m_maxLength,f=box2d.b2DotVV(this.m_u,box2d.b2SubVV(g,f,box2d.b2Vec2.s_t0));0>h&&(f+=a.step.inv_dt*
h);h=-this.m_mass*f;f=this.m_impulse;this.m_impulse=box2d.b2Min(0,this.m_impulse+h);h=this.m_impulse-f;h=box2d.b2MulSV(h,this.m_u,box2d.b2RopeJoint.prototype.SolveVelocityConstraints.s_P);b.SelfMulSub(this.m_invMassA,h);c-=this.m_invIA*box2d.b2CrossVV(this.m_rA,h);e.SelfMulAdd(this.m_invMassB,h);d+=this.m_invIB*box2d.b2CrossVV(this.m_rB,h);a.velocities[this.m_indexA].w=c;a.velocities[this.m_indexB].w=d};goog.exportProperty(box2d.b2RopeJoint.prototype,"SolveVelocityConstraints",box2d.b2RopeJoint.prototype.SolveVelocityConstraints);
box2d.b2RopeJoint.prototype.SolveVelocityConstraints.s_vpA=new box2d.b2Vec2;box2d.b2RopeJoint.prototype.SolveVelocityConstraints.s_vpB=new box2d.b2Vec2;box2d.b2RopeJoint.prototype.SolveVelocityConstraints.s_P=new box2d.b2Vec2;
box2d.b2RopeJoint.prototype.SolvePositionConstraints=function(a){var b=a.positions[this.m_indexA].c,c=a.positions[this.m_indexA].a,e=a.positions[this.m_indexB].c,d=a.positions[this.m_indexB].a,f=this.m_qA.SetAngleRadians(c),g=this.m_qB.SetAngleRadians(d);box2d.b2SubVV(this.m_localAnchorA,this.m_localCenterA,this.m_lalcA);f=box2d.b2MulRV(f,this.m_lalcA,this.m_rA);box2d.b2SubVV(this.m_localAnchorB,this.m_localCenterB,this.m_lalcB);var g=box2d.b2MulRV(g,this.m_lalcB,this.m_rB),h=this.m_u.Copy(e).SelfAdd(g).SelfSub(b).SelfSub(f),
l=h.Normalize(),k=l-this.m_maxLength,k=box2d.b2Clamp(k,0,box2d.b2_maxLinearCorrection),h=box2d.b2MulSV(-this.m_mass*k,h,box2d.b2RopeJoint.prototype.SolvePositionConstraints.s_P);b.SelfMulSub(this.m_invMassA,h);c-=this.m_invIA*box2d.b2CrossVV(f,h);e.SelfMulAdd(this.m_invMassB,h);d+=this.m_invIB*box2d.b2CrossVV(g,h);a.positions[this.m_indexA].a=c;a.positions[this.m_indexB].a=d;return l-this.m_maxLength<box2d.b2_linearSlop};goog.exportProperty(box2d.b2RopeJoint.prototype,"SolvePositionConstraints",box2d.b2RopeJoint.prototype.SolvePositionConstraints);
box2d.b2RopeJoint.prototype.SolvePositionConstraints.s_P=new box2d.b2Vec2;box2d.b2RopeJoint.prototype.GetAnchorA=function(a){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA,a)};goog.exportProperty(box2d.b2RopeJoint.prototype,"GetAnchorA",box2d.b2RopeJoint.prototype.GetAnchorA);box2d.b2RopeJoint.prototype.GetAnchorB=function(a){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB,a)};goog.exportProperty(box2d.b2RopeJoint.prototype,"GetAnchorB",box2d.b2RopeJoint.prototype.GetAnchorB);
box2d.b2RopeJoint.prototype.GetReactionForce=function(a,b){return box2d.b2MulSV(a*this.m_impulse,this.m_u,b)};goog.exportProperty(box2d.b2RopeJoint.prototype,"GetReactionForce",box2d.b2RopeJoint.prototype.GetReactionForce);box2d.b2RopeJoint.prototype.GetReactionTorque=function(a){return 0};goog.exportProperty(box2d.b2RopeJoint.prototype,"GetReactionTorque",box2d.b2RopeJoint.prototype.GetReactionTorque);box2d.b2RopeJoint.prototype.GetLocalAnchorA=function(a){return a.Copy(this.m_localAnchorA)};
goog.exportProperty(box2d.b2RopeJoint.prototype,"GetLocalAnchorA",box2d.b2RopeJoint.prototype.GetLocalAnchorA);box2d.b2RopeJoint.prototype.GetLocalAnchorB=function(a){return a.Copy(this.m_localAnchorB)};goog.exportProperty(box2d.b2RopeJoint.prototype,"GetLocalAnchorB",box2d.b2RopeJoint.prototype.GetLocalAnchorB);box2d.b2RopeJoint.prototype.SetMaxLength=function(a){this.m_maxLength=a};goog.exportProperty(box2d.b2RopeJoint.prototype,"SetMaxLength",box2d.b2RopeJoint.prototype.SetMaxLength);
box2d.b2RopeJoint.prototype.GetMaxLength=function(){return this.m_maxLength};goog.exportProperty(box2d.b2RopeJoint.prototype,"GetMaxLength",box2d.b2RopeJoint.prototype.GetMaxLength);box2d.b2RopeJoint.prototype.GetLimitState=function(){return this.m_state};goog.exportProperty(box2d.b2RopeJoint.prototype,"GetLimitState",box2d.b2RopeJoint.prototype.GetLimitState);
box2d.b2RopeJoint.prototype.Dump=function(){if(box2d.DEBUG){var a=this.m_bodyA.m_islandIndex,b=this.m_bodyB.m_islandIndex;box2d.b2Log("  /*box2d.b2RopeJointDef*/ var jd = new box2d.b2RopeJointDef();\n");box2d.b2Log("  jd.bodyA = bodies[%d];\n",a);box2d.b2Log("  jd.bodyB = bodies[%d];\n",b);box2d.b2Log("  jd.collideConnected = %s;\n",this.m_collideConnected?"true":"false");box2d.b2Log("  jd.localAnchorA.SetXY(%.15f, %.15f);\n",this.m_localAnchorA.x,this.m_localAnchorA.y);box2d.b2Log("  jd.localAnchorB.SetXY(%.15f, %.15f);\n",
this.m_localAnchorB.x,this.m_localAnchorB.y);box2d.b2Log("  jd.maxLength = %.15f;\n",this.m_maxLength);box2d.b2Log("  joints[%d] = this.m_world.CreateJoint(jd);\n",this.m_index)}};goog.exportProperty(box2d.b2RopeJoint.prototype,"Dump",box2d.b2RopeJoint.prototype.Dump);box2d.b2GravityController=function(){box2d.b2Controller.call(this)};goog.inherits(box2d.b2GravityController,box2d.b2Controller);goog.exportSymbol("box2d.b2GravityController",box2d.b2GravityController);box2d.b2GravityController.prototype.G=1;goog.exportProperty(box2d.b2GravityController.prototype,"G",box2d.b2GravityController.prototype.G);box2d.b2GravityController.prototype.invSqr=!0;goog.exportProperty(box2d.b2GravityController.prototype,"invSqr",box2d.b2GravityController.prototype.invSqr);
box2d.b2GravityController.prototype.Step=function(a){if(this.invSqr)for(a=this.m_bodyList;a;a=a.nextBody)for(var b=a.body,c=b.GetWorldCenter(),e=b.GetMass(),d=this.m_bodyList;d!==a;d=d.nextBody){var f=d.body,g=f.GetWorldCenter(),h=f.GetMass(),l=g.x-c.x,k=g.y-c.y,m=l*l+k*k;m<box2d.b2_epsilon||(l=box2d.b2GravityController.prototype.Step.s_f.SetXY(l,k),l.SelfMul(this.G/m/box2d.b2Sqrt(m)*e*h),b.IsAwake()&&b.ApplyForce(l,c),f.IsAwake()&&f.ApplyForce(l.SelfMul(-1),g))}else for(a=this.m_bodyList;a;a=a.nextBody)for(b=
a.body,c=b.GetWorldCenter(),e=b.GetMass(),d=this.m_bodyList;d!==a;d=d.nextBody)f=d.body,g=f.GetWorldCenter(),h=f.GetMass(),l=g.x-c.x,k=g.y-c.y,m=l*l+k*k,m<box2d.b2_epsilon||(l=box2d.b2GravityController.prototype.Step.s_f.SetXY(l,k),l.SelfMul(this.G/m*e*h),b.IsAwake()&&b.ApplyForce(l,c),f.IsAwake()&&f.ApplyForce(l.SelfMul(-1),g))};goog.exportProperty(box2d.b2GravityController.prototype,"Step",box2d.b2GravityController.prototype.Step);box2d.b2GravityController.prototype.Step.s_f=new box2d.b2Vec2;box2d.b2Profile=function(){};goog.exportSymbol("box2d.b2Profile",box2d.b2Profile);box2d.b2Profile.prototype.step=0;goog.exportProperty(box2d.b2Profile.prototype,"step",box2d.b2Profile.prototype.step);box2d.b2Profile.prototype.collide=0;goog.exportProperty(box2d.b2Profile.prototype,"collide",box2d.b2Profile.prototype.collide);box2d.b2Profile.prototype.solve=0;goog.exportProperty(box2d.b2Profile.prototype,"solve",box2d.b2Profile.prototype.solve);box2d.b2Profile.prototype.solveInit=0;
goog.exportProperty(box2d.b2Profile.prototype,"solveInit",box2d.b2Profile.prototype.solveInit);box2d.b2Profile.prototype.solveVelocity=0;goog.exportProperty(box2d.b2Profile.prototype,"solveVelocity",box2d.b2Profile.prototype.solveVelocity);box2d.b2Profile.prototype.solvePosition=0;goog.exportProperty(box2d.b2Profile.prototype,"solvePosition",box2d.b2Profile.prototype.solvePosition);box2d.b2Profile.prototype.broadphase=0;goog.exportProperty(box2d.b2Profile.prototype,"broadphase",box2d.b2Profile.prototype.broadphase);
box2d.b2Profile.prototype.solveTOI=0;goog.exportProperty(box2d.b2Profile.prototype,"solveTOI",box2d.b2Profile.prototype.solveTOI);box2d.b2Profile.prototype.Reset=function(){this.solveTOI=this.broadphase=this.solvePosition=this.solveVelocity=this.solveInit=this.solve=this.collide=this.step=0;return this};goog.exportProperty(box2d.b2Profile.prototype,"Reset",box2d.b2Profile.prototype.Reset);box2d.b2TimeStep=function(){};goog.exportSymbol("box2d.b2TimeStep",box2d.b2TimeStep);
box2d.b2TimeStep.prototype.dt=0;goog.exportProperty(box2d.b2TimeStep.prototype,"dt",box2d.b2TimeStep.prototype.dt);box2d.b2TimeStep.prototype.inv_dt=0;goog.exportProperty(box2d.b2TimeStep.prototype,"inv_dt",box2d.b2TimeStep.prototype.inv_dt);box2d.b2TimeStep.prototype.dtRatio=0;goog.exportProperty(box2d.b2TimeStep.prototype,"dtRatio",box2d.b2TimeStep.prototype.dtRatio);box2d.b2TimeStep.prototype.velocityIterations=0;goog.exportProperty(box2d.b2TimeStep.prototype,"velocityIterations",box2d.b2TimeStep.prototype.velocityIterations);
box2d.b2TimeStep.prototype.positionIterations=0;goog.exportProperty(box2d.b2TimeStep.prototype,"positionIterations",box2d.b2TimeStep.prototype.positionIterations);box2d.b2TimeStep.prototype.warmStarting=!1;goog.exportProperty(box2d.b2TimeStep.prototype,"warmStarting",box2d.b2TimeStep.prototype.warmStarting);
box2d.b2TimeStep.prototype.Copy=function(a){this.dt=a.dt;this.inv_dt=a.inv_dt;this.dtRatio=a.dtRatio;this.positionIterations=a.positionIterations;this.velocityIterations=a.velocityIterations;this.warmStarting=a.warmStarting;return this};goog.exportProperty(box2d.b2TimeStep.prototype,"Copy",box2d.b2TimeStep.prototype.Copy);box2d.b2Position=function(){this.c=new box2d.b2Vec2};goog.exportSymbol("box2d.b2Position",box2d.b2Position);box2d.b2Position.prototype.c=null;
goog.exportProperty(box2d.b2Position.prototype,"c",box2d.b2Position.prototype.c);box2d.b2Position.prototype.a=0;goog.exportProperty(box2d.b2Position.prototype,"a",box2d.b2Position.prototype.a);box2d.b2Position.MakeArray=function(a){return box2d.b2MakeArray(a,function(a){return new box2d.b2Position})};goog.exportProperty(box2d.b2Position,"MakeArray",box2d.b2Position.MakeArray);box2d.b2Velocity=function(){this.v=new box2d.b2Vec2};goog.exportSymbol("box2d.b2Velocity",box2d.b2Velocity);
box2d.b2Velocity.prototype.v=null;goog.exportProperty(box2d.b2Velocity.prototype,"v",box2d.b2Velocity.prototype.v);box2d.b2Velocity.prototype.w=0;goog.exportProperty(box2d.b2Velocity.prototype,"w",box2d.b2Velocity.prototype.w);box2d.b2Velocity.MakeArray=function(a){return box2d.b2MakeArray(a,function(a){return new box2d.b2Velocity})};goog.exportProperty(box2d.b2Velocity,"MakeArray",box2d.b2Velocity.MakeArray);box2d.b2SolverData=function(){this.step=new box2d.b2TimeStep};
goog.exportSymbol("box2d.b2SolverData",box2d.b2SolverData);box2d.b2SolverData.prototype.step=null;goog.exportProperty(box2d.b2SolverData.prototype,"step",box2d.b2SolverData.prototype.step);box2d.b2SolverData.prototype.positions=null;goog.exportProperty(box2d.b2SolverData.prototype,"positions",box2d.b2SolverData.prototype.positions);box2d.b2SolverData.prototype.velocities=null;goog.exportProperty(box2d.b2SolverData.prototype,"velocities",box2d.b2SolverData.prototype.velocities);box2d.b2Collision={};box2d.b2ContactFeatureType={e_vertex:0,e_face:1};goog.exportSymbol("box2d.b2ContactFeatureType",box2d.b2ContactFeatureType);goog.exportProperty(box2d.b2ContactFeatureType,"e_vertex",box2d.b2ContactFeatureType.e_vertex);goog.exportProperty(box2d.b2ContactFeatureType,"e_face",box2d.b2ContactFeatureType.e_face);box2d.b2ContactFeature=function(a){this._id=a};goog.exportSymbol("box2d.b2ContactFeature",box2d.b2ContactFeature);box2d.b2ContactFeature.prototype._id=null;
goog.exportProperty(box2d.b2ContactFeature.prototype,"_id",box2d.b2ContactFeature.prototype._id);box2d.b2ContactFeature.prototype._indexA=0;goog.exportProperty(box2d.b2ContactFeature.prototype,"_indexA",box2d.b2ContactFeature.prototype._indexA);box2d.b2ContactFeature.prototype._indexB=0;goog.exportProperty(box2d.b2ContactFeature.prototype,"_indexB",box2d.b2ContactFeature.prototype._indexB);box2d.b2ContactFeature.prototype._typeA=0;goog.exportProperty(box2d.b2ContactFeature.prototype,"_typeA",box2d.b2ContactFeature.prototype._typeA);
box2d.b2ContactFeature.prototype._typeB=0;goog.exportProperty(box2d.b2ContactFeature.prototype,"_typeB",box2d.b2ContactFeature.prototype._typeB);Object.defineProperty(box2d.b2ContactFeature.prototype,"indexA",{enumerable:!1,configurable:!0,get:function(){return this._indexA},set:function(a){this._indexA=a;this._id._key=this._id._key&4294967040|this._indexA&255}});
Object.defineProperty(box2d.b2ContactFeature.prototype,"indexB",{enumerable:!1,configurable:!0,get:function(){return this._indexB},set:function(a){this._indexB=a;this._id._key=this._id._key&4294902015|this._indexB<<8&65280}});Object.defineProperty(box2d.b2ContactFeature.prototype,"typeA",{enumerable:!1,configurable:!0,get:function(){return this._typeA},set:function(a){this._typeA=a;this._id._key=this._id._key&4278255615|this._typeA<<16&16711680}});
Object.defineProperty(box2d.b2ContactFeature.prototype,"typeB",{enumerable:!1,configurable:!0,get:function(){return this._typeB},set:function(a){this._typeB=a;this._id._key=this._id._key&16777215|this._typeB<<24&4278190080}});box2d.b2ContactID=function(){this.cf=new box2d.b2ContactFeature(this)};goog.exportSymbol("box2d.b2ContactID",box2d.b2ContactID);box2d.b2ContactID.prototype.cf=null;goog.exportProperty(box2d.b2ContactID.prototype,"cf",box2d.b2ContactID.prototype.cf);
box2d.b2ContactID.prototype.key=0;goog.exportProperty(box2d.b2ContactID.prototype,"key",box2d.b2ContactID.prototype.key);box2d.b2ContactID.prototype.Copy=function(a){this.key=a.key;return this};goog.exportProperty(box2d.b2ContactID.prototype,"Copy",box2d.b2ContactID.prototype.Copy);box2d.b2ContactID.prototype.Clone=function(){return(new box2d.b2ContactID).Copy(this)};goog.exportProperty(box2d.b2ContactID.prototype,"Clone",box2d.b2ContactID.prototype.Clone);
Object.defineProperty(box2d.b2ContactID.prototype,"key",{enumerable:!1,configurable:!0,get:function(){return this._key},set:function(a){this._key=a;this.cf._indexA=this._key&255;this.cf._indexB=this._key>>8&255;this.cf._typeA=this._key>>16&255;this.cf._typeB=this._key>>24&255}});box2d.b2ManifoldPoint=function(){this.localPoint=new box2d.b2Vec2;this.id=new box2d.b2ContactID};goog.exportSymbol("box2d.b2ManifoldPoint",box2d.b2ManifoldPoint);box2d.b2ManifoldPoint.prototype.localPoint=null;
goog.exportProperty(box2d.b2ManifoldPoint.prototype,"localPoint",box2d.b2ManifoldPoint.prototype.localPoint);box2d.b2ManifoldPoint.prototype.normalImpulse=0;goog.exportProperty(box2d.b2ManifoldPoint.prototype,"normalImpulse",box2d.b2ManifoldPoint.prototype.normalImpulse);box2d.b2ManifoldPoint.prototype.tangentImpulse=0;goog.exportProperty(box2d.b2ManifoldPoint.prototype,"tangentImpulse",box2d.b2ManifoldPoint.prototype.tangentImpulse);box2d.b2ManifoldPoint.prototype.id=null;
goog.exportProperty(box2d.b2ManifoldPoint.prototype,"id",box2d.b2ManifoldPoint.prototype.id);box2d.b2ManifoldPoint.MakeArray=function(a){return box2d.b2MakeArray(a,function(a){return new box2d.b2ManifoldPoint})};goog.exportProperty(box2d.b2ManifoldPoint,"MakeArray",box2d.b2ManifoldPoint.MakeArray);box2d.b2ManifoldPoint.prototype.Reset=function(){this.localPoint.SetZero();this.tangentImpulse=this.normalImpulse=0;this.id.key=0};goog.exportProperty(box2d.b2ManifoldPoint.prototype,"Reset",box2d.b2ManifoldPoint.prototype.Reset);
box2d.b2ManifoldPoint.prototype.Copy=function(a){this.localPoint.Copy(a.localPoint);this.normalImpulse=a.normalImpulse;this.tangentImpulse=a.tangentImpulse;this.id.Copy(a.id);return this};goog.exportProperty(box2d.b2ManifoldPoint.prototype,"Copy",box2d.b2ManifoldPoint.prototype.Copy);box2d.b2ManifoldType={e_unknown:-1,e_circles:0,e_faceA:1,e_faceB:2};goog.exportSymbol("box2d.b2ManifoldType",box2d.b2ManifoldType);goog.exportProperty(box2d.b2ManifoldType,"e_unknown",box2d.b2ManifoldType.e_unknown);
goog.exportProperty(box2d.b2ManifoldType,"e_circles",box2d.b2ManifoldType.e_circles);goog.exportProperty(box2d.b2ManifoldType,"e_faceA",box2d.b2ManifoldType.e_faceA);goog.exportProperty(box2d.b2ManifoldType,"e_faceB",box2d.b2ManifoldType.e_faceB);box2d.b2Manifold=function(){this.points=box2d.b2ManifoldPoint.MakeArray(box2d.b2_maxManifoldPoints);this.localNormal=new box2d.b2Vec2;this.localPoint=new box2d.b2Vec2;this.type=box2d.b2ManifoldType.e_unknown;this.pointCount=0};
goog.exportSymbol("box2d.b2Manifold",box2d.b2Manifold);box2d.b2Manifold.prototype.points=null;goog.exportProperty(box2d.b2Manifold.prototype,"points",box2d.b2Manifold.prototype.points);box2d.b2Manifold.prototype.localNormal=null;goog.exportProperty(box2d.b2Manifold.prototype,"localNormal",box2d.b2Manifold.prototype.localNormal);box2d.b2Manifold.prototype.localPoint=null;goog.exportProperty(box2d.b2Manifold.prototype,"localPoint",box2d.b2Manifold.prototype.localPoint);
box2d.b2Manifold.prototype.type=box2d.b2ManifoldType.e_unknown;goog.exportProperty(box2d.b2Manifold.prototype,"type",box2d.b2Manifold.prototype.type);box2d.b2Manifold.prototype.pointCount=0;goog.exportProperty(box2d.b2Manifold.prototype,"pointCount",box2d.b2Manifold.prototype.pointCount);
box2d.b2Manifold.prototype.Reset=function(){for(var a=0,b=box2d.b2_maxManifoldPoints;a<b;++a)this.points[a].Reset();this.localNormal.SetZero();this.localPoint.SetZero();this.type=box2d.b2ManifoldType.e_unknown;this.pointCount=0};goog.exportProperty(box2d.b2Manifold.prototype,"Reset",box2d.b2Manifold.prototype.Reset);
box2d.b2Manifold.prototype.Copy=function(a){this.pointCount=a.pointCount;for(var b=0,c=box2d.b2_maxManifoldPoints;b<c;++b)this.points[b].Copy(a.points[b]);this.localNormal.Copy(a.localNormal);this.localPoint.Copy(a.localPoint);this.type=a.type;return this};goog.exportProperty(box2d.b2Manifold.prototype,"Copy",box2d.b2Manifold.prototype.Copy);box2d.b2Manifold.prototype.Clone=function(){return(new box2d.b2Manifold).Copy(this)};goog.exportProperty(box2d.b2Manifold.prototype,"Clone",box2d.b2Manifold.prototype.Clone);
box2d.b2WorldManifold=function(){this.normal=new box2d.b2Vec2;this.points=box2d.b2Vec2.MakeArray(box2d.b2_maxManifoldPoints);this.separations=box2d.b2MakeNumberArray(box2d.b2_maxManifoldPoints)};goog.exportSymbol("box2d.b2WorldManifold",box2d.b2WorldManifold);box2d.b2WorldManifold.prototype.normal=null;goog.exportProperty(box2d.b2WorldManifold.prototype,"normal",box2d.b2WorldManifold.prototype.normal);box2d.b2WorldManifold.prototype.points=null;
goog.exportProperty(box2d.b2WorldManifold.prototype,"points",box2d.b2WorldManifold.prototype.points);box2d.b2WorldManifold.prototype.separations=null;goog.exportProperty(box2d.b2WorldManifold.prototype,"separations",box2d.b2WorldManifold.prototype.separations);
box2d.b2WorldManifold.prototype.Initialize=function(a,b,c,e,d){if(0!==a.pointCount)switch(a.type){case box2d.b2ManifoldType.e_circles:this.normal.SetXY(1,0);b=box2d.b2MulXV(b,a.localPoint,box2d.b2WorldManifold.prototype.Initialize.s_pointA);a=box2d.b2MulXV(e,a.points[0].localPoint,box2d.b2WorldManifold.prototype.Initialize.s_pointB);box2d.b2DistanceSquaredVV(b,a)>box2d.b2_epsilon_sq&&box2d.b2SubVV(a,b,this.normal).SelfNormalize();var f=box2d.b2AddVMulSV(b,c,this.normal,box2d.b2WorldManifold.prototype.Initialize.s_cA),
g=box2d.b2SubVMulSV(a,d,this.normal,box2d.b2WorldManifold.prototype.Initialize.s_cB);box2d.b2MidVV(f,g,this.points[0]);this.separations[0]=box2d.b2DotVV(box2d.b2SubVV(g,f,box2d.b2Vec2.s_t0),this.normal);break;case box2d.b2ManifoldType.e_faceA:box2d.b2MulRV(b.q,a.localNormal,this.normal);for(var h=box2d.b2MulXV(b,a.localPoint,box2d.b2WorldManifold.prototype.Initialize.s_planePoint),l=0,k=a.pointCount;l<k;++l){var m=box2d.b2MulXV(e,a.points[l].localPoint,box2d.b2WorldManifold.prototype.Initialize.s_clipPoint),
f=c-box2d.b2DotVV(box2d.b2SubVV(m,h,box2d.b2Vec2.s_t0),this.n
Download .txt
gitextract_1prx5pti/

├── Readme.md
├── index.html
├── lib/
│   ├── box2d-camera.js
│   ├── box2d-helper.js
│   ├── box2d-html5.js
│   ├── convnetjs/
│   │   ├── convnet-min.js
│   │   ├── convnet.js
│   │   ├── deepqlearn.js
│   │   ├── ga.js
│   │   ├── util.js
│   │   └── vis.js
│   ├── orientation-0.03.js
│   ├── p5.dom.js
│   ├── p5.js
│   └── p5.sound.js
├── pro/
│   └── index.html
├── pro.html
├── slimevolley.js
├── slimevolley_pro.js
└── useful.js
Download .txt
SYMBOL INDEX (113 symbols across 11 files)

FILE: lib/box2d-html5.js
  function a (line 9) | function a(d){if(!(d in e.written)){if(!(d in e.visited)&&(e.visited[d]=...
  function c (line 20) | function c(){}

FILE: lib/convnetjs/convnet-min.js
  function a (line 1) | function a(q,p){if(!q){p=p||"Assertion failed";if(typeof Error!=="undefi...
  function c (line 1) | function c(h){var i=Math.exp(2*h);return(i-1)/(i+1)}

FILE: lib/convnetjs/convnet.js
  function tanh (line 1226) | function tanh(x) {

FILE: lib/convnetjs/ga.js
  function assert (line 46) | function assert(condition, message) {
  function getNetworkSize (line 139) | function getNetworkSize(net) {
  function pushGeneToNetwork (line 164) | function pushGeneToNetwork(net, gene) { // pushes the gene (floatArray) ...
  function getGeneFromNetwork (line 192) | function getGeneFromNetwork(net) { // gets all the weight/biases from ne...
  function copyFloatArray (line 221) | function copyFloatArray(x) { // returns a FloatArray copy of real number...
  function copyFloatArrayIntoArray (line 230) | function copyFloatArrayIntoArray(x, y) { // copies a FloatArray copy of ...
  function getGenesFromChromosomes (line 649) | function getGenesFromChromosomes(s) {
  function makeCopyOfGenes (line 658) | function makeCopyOfGenes(s) {
  function randomizeSubPopulation (line 667) | function randomizeSubPopulation(n, c) {
  function compareChromosomes (line 674) | function compareChromosomes(a, b) {

FILE: lib/orientation-0.03.js
  function getMobileOperatingSystem (line 9) | function getMobileOperatingSystem() {

FILE: lib/p5.dom.js
  function wrapElement (line 82) | function wrapElement(elt) {
  function addElement (line 119) | function addElement(elt, pInst, media) {
  function handleFileSelect (line 310) | function handleFileSelect(evt) {
  function createMedia (line 345) | function createMedia(pInst, type, src, callback) {

FILE: lib/p5.js
  function makeLoader (line 618) | function makeLoader(theFile) {
  function attachListener (line 657) | function attachListener(ev, fxn, ctx) {
  function buildBlurKernel (line 935) | function buildBlurKernel(r) {
  function blurARGB (line 963) | function blurARGB(canvas, radius) {
  function doNf (line 2039) | function doNf() {
  function doNfc (line 2076) | function doNfc() {
  function addNfp (line 2098) | function addNfp() {
  function addNfs (line 2109) | function addNfs() {
  function launchFullscreen (line 2222) | function launchFullscreen(element) {
  function exitFullscreen (line 2237) | function exitFullscreen() {
  function handleReadyState (line 2609) | function handleReadyState(r, success, error) {
  function setHeaders (line 2622) | function setHeaders(http, o) {
  function setCredentials (line 2632) | function setCredentials(http, o) {
  function generalCallback (line 2637) | function generalCallback(data) {
  function urlappend (line 2640) | function urlappend(url, s) {
  function handleJsonp (line 2643) | function handleJsonp(o, fn, err, url) {
  function getRequest (line 2684) | function getRequest(fn, err) {
  function Reqwest (line 2715) | function Reqwest(o, fn) {
  function setType (line 2720) | function setType(url) {
  function init (line 2724) | function init(o, fn) {
  function reqwest (line 2854) | function reqwest(o, fn) {
  function normalize (line 2857) | function normalize(s) {
  function serial (line 2860) | function serial(el, cb) {
  function eachFormElement (line 2890) | function eachFormElement() {
  function serializeQueryString (line 2910) | function serializeQueryString() {
  function serializeHash (line 2913) | function serializeHash() {
  function buildParams (line 2965) | function buildParams(prefix, obj, traditional, add) {
  function makeObject (line 3114) | function makeObject(row, headers) {
  function getMousePos (line 3305) | function getMousePos(canvas, evt) {
  function getTouchPos (line 3467) | function getTouchPos(canvas, e, i) {
  function _checkFileExtension (line 4074) | function _checkFileExtension(filename, extension) {
  function destroyClickedElement (line 4101) | function destroyClickedElement(event) {
  function createArc (line 4309) | function createArc(radius, startAngle, endAngle) {
  function createSmallArc (line 4324) | function createSmallArc(r, a1, a2) {

FILE: lib/p5.sound.js
  function isUndef (line 1983) | function isUndef(val) {
  function TempConstructor (line 2242) | function TempConstructor() {
  function createDCOffset (line 3671) | function createDCOffset() {
  function playNextPart (line 5703) | function playNextPart(aScore) {
  function interleave (line 5979) | function interleave(leftChannel, rightChannel) {
  function writeUTFBytes (line 5990) | function writeUTFBytes(view, offset, string) {

FILE: slimevolley.js
  function moveHandSymbol (line 77) | function moveHandSymbol(x, y) {
  function hideHandSymbol (line 87) | function hideHandSymbol() {
  function showHandSymbol (line 94) | function showHandSymbol() {
  function toX (line 119) | function toX(x) {
  function toP (line 122) | function toP(x) {
  function toY (line 125) | function toY(y) {
  function Particle (line 144) | function Particle(loc, v, r, c) { // location p5.Vector, velocity p5.Vec...
  function Brain (line 243) | function Brain() {
  function matchFunction (line 340) | function matchFunction(chromosome1, chromosome2) { // this function is p...
  function Trainer (line 355) | function Trainer(brain, initialGene) {
  function Agent (line 380) | function Agent(dir, loc, c) {
  function Wall (line 617) | function Wall(x, y, w, h) {
  function initGame (line 635) | function initGame() {
  function setup (line 651) | function setup() {
  function update (line 692) | function update(nStep) {
  function drawScenery (line 773) | function drawScenery() {
  function keyboardControl (line 791) | function keyboardControl() {
  function touchControl (line 819) | function touchControl() {
  function betweenGameControl (line 857) | function betweenGameControl() {
  function getNNDebugString (line 874) | function getNNDebugString() {
  function arrayToString (line 886) | function arrayToString(x, precision) {
  function drawArrowKeyboard (line 902) | function drawArrowKeyboard(x, y, s1, c, intensity, theColor) {
  function drawAgentKeyboard (line 970) | function drawAgentKeyboard(x, y, s, n, intensity, theColor) {
  function draw (line 976) | function draw() {
  function windowResized (line 1055) | function windowResized() {

FILE: slimevolley_pro.js
  function moveHandSymbol (line 75) | function moveHandSymbol(x, y) {
  function hideHandSymbol (line 85) | function hideHandSymbol() {
  function showHandSymbol (line 92) | function showHandSymbol() {
  function toX (line 117) | function toX(x) {
  function toP (line 120) | function toP(x) {
  function toY (line 123) | function toY(y) {
  function Particle (line 142) | function Particle(loc, v, r, c) { // location p5.Vector, velocity p5.Vec...
  function Brain (line 241) | function Brain() {
  function matchFunction (line 338) | function matchFunction(chromosome1, chromosome2) { // this function is p...
  function Trainer (line 353) | function Trainer(brain, initialGene) {
  function Agent (line 378) | function Agent(dir, loc, c) {
  function Wall (line 615) | function Wall(x, y, w, h) {
  function initGame (line 633) | function initGame() {
  function setup (line 649) | function setup() {
  function update (line 690) | function update(nStep) {
  function drawScenery (line 773) | function drawScenery() {
  function keyboardControl (line 791) | function keyboardControl() {
  function touchControl (line 819) | function touchControl() {
  function betweenGameControl (line 857) | function betweenGameControl() {
  function getNNDebugString (line 874) | function getNNDebugString() {
  function arrayToString (line 886) | function arrayToString(x, precision) {
  function drawArrowKeyboard (line 902) | function drawArrowKeyboard(x, y, s1, c, intensity, theColor) {
  function drawAgentKeyboard (line 970) | function drawAgentKeyboard(x, y, s, n, intensity, theColor) {
  function draw (line 976) | function draw() {
  function windowResized (line 1060) | function windowResized() {

FILE: useful.js
  function rectify (line 11) | function rectify(x, minValue, maxValue) {
  function getWidth (line 17) | function getWidth() {
  function getHeight (line 21) | function getHeight() {
Condensed preview — 20 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,224K chars).
[
  {
    "path": "Readme.md",
    "chars": 1298,
    "preview": "\n# Neural Slime Volleyball\n\nHTML5-JS Slime Volleyball clone.  AI agent is a trained recurrent neural network, trained us"
  },
  {
    "path": "index.html",
    "chars": 3946,
    "preview": "<html>\n<head>\n  <title>neural slime volleyball</title>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"wid"
  },
  {
    "path": "lib/box2d-camera.js",
    "chars": 5074,
    "preview": "\n// -----------------------------------------------------------------------------\n// Scale Methods\n// ------------------"
  },
  {
    "path": "lib/box2d-helper.js",
    "chars": 4385,
    "preview": "\n// -----------------------------------------------------------------------------\n// Scale Methods\n// ------------------"
  },
  {
    "path": "lib/box2d-html5.js",
    "chars": 543451,
    "preview": "var COMPILED=!0,goog=goog||{};goog.global=this;goog.DEBUG=!1;goog.LOCALE=\"en\";goog.TRUSTED_SITE=!0;goog.provide=function"
  },
  {
    "path": "lib/convnetjs/convnet-min.js",
    "chars": 33796,
    "preview": "var convnetjs=convnetjs||{REVISION:\"ALPHA\"};(function(d){var k=false;var e=0;var l=function(){if(k){k=false;return e}var"
  },
  {
    "path": "lib/convnetjs/convnet.js",
    "chars": 74318,
    "preview": "var convnetjs = convnetjs || { REVISION: 'ALPHA' };\n(function(global) {\n  \"use strict\";\n\n  // Random number utilities\n  "
  },
  {
    "path": "lib/convnetjs/deepqlearn.js",
    "chars": 13724,
    "preview": "var deepqlearn = deepqlearn || { REVISION: 'ALPHA' };\r\n\r\n(function(global) {\r\n  \"use strict\";\r\n  \r\n  // An agent is in s"
  },
  {
    "path": "lib/convnetjs/ga.js",
    "chars": 29889,
    "preview": "\n/*    \n\nGA addon for convnet.js\n\n@licstart  The following is the entire license notice for the \nJavaScript code in this"
  },
  {
    "path": "lib/convnetjs/util.js",
    "chars": 1722,
    "preview": "\n// contains various utility functions \nvar cnnutil = (function(exports){\n\n  // a window stores _size_ number of values\n"
  },
  {
    "path": "lib/convnetjs/vis.js",
    "chars": 5819,
    "preview": "\n// contains various utility functions \nvar cnnvis = (function(exports){\n\n  // can be used to graph loss, or accuract ov"
  },
  {
    "path": "lib/orientation-0.03.js",
    "chars": 2799,
    "preview": "// get orientation of mobile device\n\n/**\n * Determine the mobile operating system.\n * This function either returns 'iOS'"
  },
  {
    "path": "lib/p5.dom.js",
    "chars": 31683,
    "preview": "/*! p5.dom.js v0.2.0 February 2, 2015 */\n/**\n * <p>The web is much more than just canvas and p5.dom makes it easy to int"
  },
  {
    "path": "lib/p5.js",
    "chars": 162084,
    "preview": "/*! p5.js v0.4.2 February 16, 2015 */\n(function (root, factory) {\n  if (typeof define === 'function' && define.amd)\n    "
  },
  {
    "path": "lib/p5.sound.js",
    "chars": 205451,
    "preview": "/*! p5.sound.js v0.1.7 2015-02-02 */\n(function (root, factory) {\n  if (typeof define === 'function' && define.amd)\n    d"
  },
  {
    "path": "pro/index.html",
    "chars": 974,
    "preview": "<!DOCTYPE HTML>\n<html lang=\"en-US\">\n    <head>\n        <meta charset=\"UTF-8\">\n        <meta http-equiv=\"refresh\" content"
  },
  {
    "path": "pro.html",
    "chars": 4035,
    "preview": "<html>\n<head>\n  <title>neural slime volleyball</title>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"wid"
  },
  {
    "path": "slimevolley.js",
    "chars": 35406,
    "preview": "\n\n/*    \n\np5.js implementation of slime volleyball, with evolved neural networks to be the ai.\n\n@licstart  The following"
  },
  {
    "path": "slimevolley_pro.js",
    "chars": 33907,
    "preview": "\n\n/*    \n\np5.js implementation of slime volleyball, with evolved neural networks to be the ai.\n\n@licstart  The following"
  },
  {
    "path": "useful.js",
    "chars": 1335,
    "preview": "// useful simple math functions\n\nsign = Math.sign || function sign(x) {\n  x = +x; // convert to a number\n  if (x === 0 |"
  }
]

About this extraction

This page contains the full source code of the hardmaru/neuralslimevolley GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 20 files (1.1 MB), approximately 359.2k tokens, and a symbol index with 113 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!