odin
Version:
Node.js Canvas/WebGL Javascript Game Framework
132 lines (98 loc) • 3.84 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: phys2d/constraints/p2equation.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: phys2d/constraints/p2equation.js</h1>
<section>
<article>
<pre class="prettyprint source"><code>if (typeof define !== "function") {
var define = require("amdefine")(module);
}
define([
"odin/base/class"
],
function(Class) {
"use strict";
/**
* @class P2Equation
* @extends Class
* @brief 2d contact equation
*/
function P2Equation() {
Class.call(this);
/**
* @property P2Body sj
* @memberof P2Equation
*/
this.bi = undefined;
/**
* @property P2Body bj
* @memberof P2Equation
*/
this.bj = undefined;
/**
* @property Number minForce
* @memberof P2Equation
*/
this.minForce = -1e6;
/**
* @property Number maxForce
* @memberof P2Equation
*/
this.maxForce = 1e6;
/**
* @property Number relaxation
* @brief number of timesteps it takesto stabilize the constraint
* @memberof P2Equation
*/
this.relaxation = 3;
/**
* @property Number stiffness
* @brief spring constant
* @memberof P2Equation
*/
this.stiffness = 1e7;
this.a = 0;
this.b = 0;
this.eps = 0;
this.lambda = 0;
this.B = 0;
this.invC = 0;
}
Class.extend(P2Equation, Class);
P2Equation.prototype.updateConstants = function(h) {
var k = this.stiffness,
d = this.relaxation;
this.a = 4 / (h * (1 + 4 * d));
this.b = (4 * d) / (1 + 4 * d);
this.eps = 4 / (h * h * k * (1 + 4 * d))
};
return P2Equation;
}
);
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Canvas.html">Canvas</a></li><li><a href="GUIObject.html">GUIObject</a></li><li><a href="MeshFilter.html">MeshFilter</a></li><li><a href="Odin.html">Odin</a></li><li><a href="Odin.Class.html">Class</a></li><li><a href="Odin.EventEmitter.html">EventEmitter</a></li><li><a href="Odin.GameObject.html">GameObject</a></li><li><a href="Odin.Scene.html">Scene</a></li><li><a href="P2Contact.html">P2Contact</a></li><li><a href="P2Equation.html">P2Equation</a></li><li><a href="P2Friction.html">P2Friction</a></li><li><a href="P2Solver.html">P2Solver</a></li><li><a href="ParticleSystem.html">ParticleSystem</a></li><li><a href="Renderer.html">Renderer</a></li><li><a href="SpriteAnimation.html">SpriteAnimation</a></li><li><a href="WebGLRenderer.html">WebGLRenderer</a></li><li><a href="WebGLRenderer2D.html">WebGLRenderer2D</a></li></ul>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Feb 24 2014 16:15:46 GMT-0600 (CST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>