Skip to content

Commit

Permalink
Merge branch 'pr/60'
Browse files Browse the repository at this point in the history
[liabru] corrected some of the param types before merge

Conflicts:
	src/body/Body.js
	src/collision/Resolver.js
	src/render/Render.js
	src/render/RenderPixi.js
  • Loading branch information
liabru committed May 24, 2015
2 parents 9561d5d + a940d96 commit 42dc72d
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 33 deletions.
8 changes: 4 additions & 4 deletions src/body/Body.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var Body = {};
/**
* Creates a new rigid body model. The options parameter is an object that specifies any properties you wish to override the defaults.
* All properties have default values, and many are pre-calculated automatically based on other properties.
* See the properites section below for detailed information on what you can pass via the `options` object.
* See the properties section below for detailed information on what you can pass via the `options` object.
* @method create
* @param {} options
* @return {body} body
Expand Down Expand Up @@ -515,7 +515,7 @@ var Body = {};
velocityPrevX = body.position.x - body.positionPrev.x,
velocityPrevY = body.position.y - body.positionPrev.y;

// update velocity with verlet integration
// update velocity with Verlet integration
body.velocity.x = (velocityPrevX * frictionAir * correction) + (body.force.x / body.mass) * deltaTimeSquared;
body.velocity.y = (velocityPrevY * frictionAir * correction) + (body.force.y / body.mass) * deltaTimeSquared;

Expand All @@ -524,7 +524,7 @@ var Body = {};
body.position.x += body.velocity.x;
body.position.y += body.velocity.y;

// update angular velocity with verlet integration
// update angular velocity with Verlet integration
body.angularVelocity = ((body.angle - body.anglePrev) * frictionAir * correction) + (body.torque / body.inertia) * deltaTimeSquared;
body.anglePrev = body.angle;
body.angle += body.angularVelocity;
Expand Down Expand Up @@ -668,7 +668,7 @@ var Body = {};
*
* [{ x: 0, y: 0 }, { x: 25, y: 50 }, { x: 50, y: 0 }]
*
* When passed via `Body.create`, the verticies are translated relative to `body.position` (i.e. world-space, and constantly updated by `Body.update` during simulation).
* When passed via `Body.create`, the vertices are translated relative to `body.position` (i.e. world-space, and constantly updated by `Body.update` during simulation).
* The `Vector` objects are also augmented with additional properties required for efficient collision detection.
*
* Other properties such as `inertia` and `bounds` are automatically calculated from the passed vertices (unless provided via `options`).
Expand Down
4 changes: 2 additions & 2 deletions src/body/Composite.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ var Composite = {};
* Removes all bodies, constraints and composites from the given composite
* Optionally clearing its children recursively
* @method clear
* @param {world} world
* @param {composite} composite
* @param {boolean} keepStatic
* @param {boolean} [deep=false]
*/
Expand Down Expand Up @@ -649,4 +649,4 @@ var Composite = {};
* @default []
*/

})();
})();
4 changes: 2 additions & 2 deletions src/body/World.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var World = {};

/**
* Creates a new world composite. The options parameter is an object that specifies any properties you wish to override the defaults.
* See the properites section below for detailed information on what you can pass via the `options` object.
* See the properties section below for detailed information on what you can pass via the `options` object.
* @method create
* @constructor
* @param {} options
Expand Down Expand Up @@ -73,4 +73,4 @@ var World = {};
* @return {world} The original world with the constraint added
*/

})();
})();
3 changes: 3 additions & 0 deletions src/collision/Pair.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var Pair = {};
* Description
* @method create
* @param {collision} collision
* @param {number} timestamp
* @return {pair} A new pair
*/
Pair.create = function(collision, timestamp) {
Expand Down Expand Up @@ -47,6 +48,7 @@ var Pair = {};
* @method update
* @param {pair} pair
* @param {collision} collision
* @param {number} timestamp
*/
Pair.update = function(pair, collision, timestamp) {
var contacts = pair.contacts,
Expand Down Expand Up @@ -89,6 +91,7 @@ var Pair = {};
* @method setActive
* @param {pair} pair
* @param {bool} isActive
* @param {number} timestamp
*/
Pair.setActive = function(pair, isActive, timestamp) {
if (isActive) {
Expand Down
8 changes: 5 additions & 3 deletions src/collision/Pairs.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var Pairs = {};
* @method update
* @param {object} pairs
* @param {collision[]} collisions
* @param {number} timestamp
*/
Pairs.update = function(pairs, collisions, timestamp) {
var pairsList = pairs.list,
Expand Down Expand Up @@ -96,6 +97,7 @@ var Pairs = {};
* Description
* @method removeOld
* @param {object} pairs
* @param {number} timestamp
*/
Pairs.removeOld = function(pairs, timestamp) {
var pairsList = pairs.list,
Expand Down Expand Up @@ -133,9 +135,9 @@ var Pairs = {};

/**
* Clears the given pairs structure
* @method create
* @param {object} options
* @method clear
* @param {pairs} pairs
* @return {pairs} pairs
*/
Pairs.clear = function(pairs) {
pairs.table = {};
Expand All @@ -146,4 +148,4 @@ var Pairs = {};
return pairs;
};

})();
})();
3 changes: 2 additions & 1 deletion src/collision/Resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ var Resolver = {};
* Description
* @method solveVelocity
* @param {pair[]} pairs
* @param {number} timeScale
*/
Resolver.solveVelocity = function(pairs, timeScale) {
var timeScaleSquared = timeScale * timeScale,
Expand Down Expand Up @@ -323,4 +324,4 @@ var Resolver = {};
}
};

})();
})();
18 changes: 9 additions & 9 deletions src/constraint/Constraint.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
* @class Constraint
*/

// TODO: fix instabillity issues with torque
// TODO: fix instability issues with torque
// TODO: linked constraints
// TODO: breakable constraints
// TODO: collidable constraints
// TODO: collision constraints
// TODO: allow constrained bodies to sleep
// TODO: handle 0 length constraints properly
// TODO: impulse caching and warming
Expand All @@ -27,7 +27,7 @@ var Constraint = {};
/**
* Creates a new constraint.
* All properties have default values, and many are pre-calculated automatically based on other properties.
* See the properites section below for detailed information on what you can pass via the `options` object.
* See the properties section below for detailed information on what you can pass via the `options` object.
* @method create
* @param {} options
* @return {constraint} constraint
Expand Down Expand Up @@ -200,8 +200,8 @@ var Constraint = {};

Sleeping.set(bodyA, false);

// clamp to prevent instabillity
// TODO: solve this properlly
// clamp to prevent instability
// TODO: solve this properly
torque = Common.clamp(torque, -0.01, 0.01);

// keep track of applied impulses for post solving
Expand All @@ -220,8 +220,8 @@ var Constraint = {};

Sleeping.set(bodyB, false);

// clamp to prevent instabillity
// TODO: solve this properlly
// clamp to prevent instability
// TODO: solve this properly
torque = Common.clamp(torque, -0.01, 0.01);

// keep track of applied impulses for post solving
Expand Down Expand Up @@ -382,10 +382,10 @@ var Constraint = {};

/**
* A `Number` that specifies the target resting length of the constraint.
* It is calculated automatically in `Constraint.create` from intial positions of the `constraint.bodyA` and `constraint.bodyB`.
* It is calculated automatically in `Constraint.create` from initial positions of the `constraint.bodyA` and `constraint.bodyB`.
*
* @property length
* @type number
*/

})();
})();
4 changes: 2 additions & 2 deletions src/constraint/MouseConstraint.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var MouseConstraint = {};
/**
* Creates a new mouse constraint.
* All properties have default values, and many are pre-calculated automatically based on other properties.
* See the properites section below for detailed information on what you can pass via the `options` object.
* See the properties section below for detailed information on what you can pass via the `options` object.
* @method create
* @param {engine} engine
* @param {} options
Expand Down Expand Up @@ -118,7 +118,7 @@ var MouseConstraint = {};
* Triggers mouse constraint events
* @method _triggerEvents
* @private
* @param {mouse} mouse
* @param {mouse} mouseConstraint
*/
var _triggerEvents = function(mouseConstraint) {
var mouse = mouseConstraint.mouse,
Expand Down
4 changes: 2 additions & 2 deletions src/core/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ var Common = {};
/**
* Description
* @method now
* @return {number} the current timestamp (high-res if avaliable)
* @return {number} the current timestamp (high-res if available)
*/
Common.now = function() {
// http://stackoverflow.com/questions/221294/how-do-you-get-a-timestamp-in-javascript
Expand Down Expand Up @@ -315,4 +315,4 @@ var Common = {};
return Common._seed / 233280;
};

})();
})();
13 changes: 6 additions & 7 deletions src/core/Engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var Engine = {};
/**
* Creates a new engine. The options parameter is an object that specifies any properties you wish to override the defaults.
* All properties have default values, and many are pre-calculated automatically based on other properties.
* See the properites section below for detailed information on what you can pass via the `options` object.
* See the properties section below for detailed information on what you can pass via the `options` object.
* @method create
* @param {HTMLElement} element
* @param {object} [options]
Expand Down Expand Up @@ -200,8 +200,7 @@ var Engine = {};
/**
* Renders the world by calling its defined renderer `engine.render.controller`. Triggers `beforeRender` and `afterRender` events.
* @method render
* @param {engine} engineA
* @param {engine} engineB
* @param {engine} engine
*/
Engine.render = function(engine) {
// create an event object
Expand Down Expand Up @@ -511,8 +510,8 @@ var Engine = {};

/**
* A `Boolean` that specifies if the `Engine.run` game loop should use a fixed timestep (otherwise it is variable).
* If timing is fixed, then the apparant simulation speed will change depending on the frame rate (but behaviour will be deterministic).
* If the timing is variable, then the apparant simulation speed will be constant (approximately, but at the cost of determininism).
* If timing is fixed, then the apparent simulation speed will change depending on the frame rate (but behaviour will be deterministic).
* If the timing is variable, then the apparent simulation speed will be constant (approximately, but at the cost of determininism).
*
* @property timing.isFixed
* @type boolean
Expand All @@ -522,7 +521,7 @@ var Engine = {};
/**
* A `Number` that specifies the time step between updates in milliseconds.
* If `engine.timing.isFixed` is set to `true`, then `delta` is fixed.
* If it is `false`, then `delta` can dynamically change to maintain the correct apparant simulation speed.
* If it is `false`, then `delta` can dynamically change to maintain the correct apparent simulation speed.
*
* @property timing.delta
* @type number
Expand Down Expand Up @@ -570,4 +569,4 @@ var Engine = {};
* @default a Matter.World instance
*/

})();
})();
2 changes: 2 additions & 0 deletions src/core/Mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ var Mouse = {};
* Sets the offset
* @method setOffset
* @param {mouse} mouse
* @param {vector} offset
*/
Mouse.setOffset = function(mouse, offset) {
mouse.offset.x = offset.x;
Expand All @@ -153,6 +154,7 @@ var Mouse = {};
* Sets the scale
* @method setScale
* @param {mouse} mouse
* @param {vector} scale
*/
Mouse.setScale = function(mouse, scale) {
mouse.scale.x = scale.x;
Expand Down
2 changes: 1 addition & 1 deletion src/render/Render.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var Render = {};
/**
* Creates a new renderer. The options parameter is an object that specifies any properties you wish to override the defaults.
* All properties have default values, and many are pre-calculated automatically based on other properties.
* See the properites section below for detailed information on what you can pass via the `options` object.
* See the properties section below for detailed information on what you can pass via the `options` object.
* @method create
* @param {object} [options]
* @return {render} A new renderer
Expand Down

0 comments on commit 42dc72d

Please sign in to comment.