Permalink
Browse files

Math library uses only double.

  • Loading branch information...
1 parent ed590d0 commit 5ba30dacf2a16861620e18d692546f0339e3bd4d @dominichamon committed Jun 4, 2013
Showing with 618 additions and 623 deletions.
  1. +1 −1 docs/0/box2d.json
  2. +1 −1 docs/0/box2d_browser.json
  3. +2 −2 docs/box2d/Body.html
  4. +4 −4 docs/box2d/Collision.html
  5. +4 −4 docs/box2d/ContactSolver.html
  6. +28 −28 docs/box2d/MathBox.html
  7. +30 −30 docs/box2d/Matrix22.html
  8. +16 −16 docs/box2d/Matrix33.html
  9. +4 −4 docs/box2d/PolygonShape.html
  10. +2 −2 docs/box2d/SeparationFunction.html
  11. +57 −57 docs/box2d/Settings.html
  12. +28 −30 docs/box2d/Simplex.html
  13. +14 −14 docs/box2d/Sweep.html
  14. +12 −12 docs/box2d/TimeOfImpact.html
  15. +2 −2 docs/box2d/TimeOfImpactSolverManifold.html
  16. +8 −8 docs/box2d/Transform.html
  17. +60 −62 docs/box2d/Vector.html
  18. +30 −34 docs/box2d/Vector3.html
  19. +21 −21 docs/box2d/ViewportTransform.html
  20. +4 −4 docs/box2d/WorldManifold.html
  21. +13 −13 docs/box2d_browser/CanvasViewportTransform.html
  22. +6 −6 example/benchmarks/ball_cage_bench.dart
  23. +2 −2 example/benchmarks/ball_drop_bench.dart
  24. +3 −3 example/benchmarks/benchmark.dart
  25. +4 −4 example/benchmarks/circle_stress_bench.dart
  26. +1 −1 example/benchmarks/domino_platform_bench.dart
  27. +4 −4 example/benchmarks/domino_tower_bench.dart
  28. +6 −6 example/demos/ball_cage.dart
  29. +78 −70 example/demos/ball_cage.dart.js
  30. +9 −9 example/demos/blob_test.dart
  31. +2 −2 example/demos/blob_test.dart.js
  32. +2 −3 example/demos/box_test.dart
  33. +4 −4 example/demos/circle_stress.dart
  34. +2 −2 example/demos/circle_stress.dart.js
  35. +1 −1 example/demos/demo.dart
  36. +1 −1 example/demos/domino_test.dart
  37. +4 −4 example/demos/domino_tower.dart
  38. +2 −2 example/demos/domino_tower.dart.js
  39. +1 −1 example/demos/friction_joint_test.dart
  40. +2 −2 example/demos/friction_joint_test.dart.js
  41. +5 −5 example/demos/racer/racer.dart
  42. +2 −2 example/demos/racer/racer.dart.js
  43. +2 −2 lib/src/collision/collision.dart
  44. +2 −2 lib/src/collision/shapes/polygon_shape.dart
  45. +14 −15 lib/src/collision/simplex.dart
  46. +7 −7 lib/src/collision/time_of_impact.dart
  47. +2 −2 lib/src/collision/world_manifold.dart
  48. +1 −1 lib/src/common/canvas_viewport_transform.dart
  49. +11 −11 lib/src/common/math_box.dart
  50. +14 −14 lib/src/common/matrix22.dart
  51. +8 −8 lib/src/common/matrix33.dart
  52. +19 −19 lib/src/common/settings.dart
  53. +5 −5 lib/src/common/sweep.dart
  54. +4 −4 lib/src/common/transform.dart
  55. +23 −24 lib/src/common/vector2.dart
  56. +11 −13 lib/src/common/vector3.dart
  57. +9 −9 lib/src/common/viewport_transform.dart
  58. +1 −1 lib/src/dynamics/body.dart
  59. +2 −2 lib/src/dynamics/contacts/contact_solver.dart
  60. +1 −1 lib/src/dynamics/contacts/time_of_impact_solver.dart
View
Oops, something went wrong.
Oops, something went wrong.
@@ -899,7 +899,7 @@
xf1.rotation.setAngle(sweep.angleZero);
Matrix22.mulMatrixAndVectorToOut(xf1.rotation, sweep.localCenter,
xf1.position);
- xf1.position.mulLocal(-1);
+ xf1.position.mulLocal(-1.0);
xf1.position.addLocal(sweep.centerZero);
BroadPhase broadPhase = world._contactManager.broadPhase;
@@ -2381,7 +2381,7 @@
xf1.rotation.setAngle(sweep.angleZero);
Matrix22.mulMatrixAndVectorToOut(xf1.rotation, sweep.localCenter,
xf1.position);
- xf1.position.mulLocal(-1);
+ xf1.position.mulLocal(-1.0);
xf1.position.addLocal(sweep.centerZero);
BroadPhase broadPhase = world._contactManager.broadPhase;
@@ -585,7 +585,7 @@
localTangent.normalize();
// Vector localNormal = Cross(dv, 1.0);
- Vector.crossVectorAndNumToOut(localTangent, 1, localNormal);
+ Vector.crossVectorAndNumToOut(localTangent, 1.0, localNormal);
// Vector planePoint = 0.5 * (v11 + v12)
planePoint.setFrom(v11).addLocal(v12).mulLocal(.5);
@@ -594,7 +594,7 @@
Matrix22.mulMatrixAndVectorToOut(xf1.rotation, localTangent, tangent);
// Vector frontNormal = Cross(sideNormal, 1.0);
- Vector.crossVectorAndNumToOut(tangent, 1, normal);
+ Vector.crossVectorAndNumToOut(tangent, 1.0, normal);
// v11 = Mul(xf1, v11);
// v12 = Mul(xf1, v12);
@@ -1154,7 +1154,7 @@
localTangent.normalize();
// Vector localNormal = Cross(dv, 1.0);
- Vector.crossVectorAndNumToOut(localTangent, 1, localNormal);
+ Vector.crossVectorAndNumToOut(localTangent, 1.0, localNormal);
// Vector planePoint = 0.5 * (v11 + v12)
planePoint.setFrom(v11).addLocal(v12).mulLocal(.5);
@@ -1163,7 +1163,7 @@
Matrix22.mulMatrixAndVectorToOut(xf1.rotation, localTangent, tangent);
// Vector frontNormal = Cross(sideNormal, 1.0);
- Vector.crossVectorAndNumToOut(tangent, 1, normal);
+ Vector.crossVectorAndNumToOut(tangent, 1.0, normal);
// v11 = Mul(xf1, v11);
// v12 = Mul(xf1, v12);
@@ -256,7 +256,7 @@
final num invMassB = bodyB.invMass;
final num invIB = bodyB.invInertia;
final Vector normal = c.normal;
- Vector.crossVectorAndNumToOut(normal, 1, tangent);
+ Vector.crossVectorAndNumToOut(normal, 1.0, tangent);
for (int j = 0; j < c.pointCount; ++j){
ContactConstraintPoint ccp = c.points[j];
@@ -391,7 +391,7 @@
while (true) {
Matrix22.mulMatrixAndVectorToOut(c.normalMass, b, x);
- x.mulLocal(-1);
+ x.mulLocal(-1.0);
if (x.x >= 0.0 && x.y >= 0.0){
// Resubstitute for the incremental impulse
@@ -1231,7 +1231,7 @@
while (true) {
Matrix22.mulMatrixAndVectorToOut(c.normalMass, b, x);
- x.mulLocal(-1);
+ x.mulLocal(-1.0);
if (x.x >= 0.0 && x.y >= 0.0){
// Resubstitute for the incremental impulse
@@ -1408,7 +1408,7 @@
final num invMassB = bodyB.invMass;
final num invIB = bodyB.invInertia;
final Vector normal = c.normal;
- Vector.crossVectorAndNumToOut(normal, 1, tangent);
+ Vector.crossVectorAndNumToOut(normal, 1.0, tangent);
for (int j = 0; j < c.pointCount; ++j){
ContactConstraintPoint ccp = c.points[j];
@@ -41,21 +41,21 @@
/**
* Return the distance between the two given vectors, but squared.
*/
- static num distanceSquared(Vector v1, Vector v2) {
- num dx = (v1.x - v2.x);
- num dy = (v1.y - v2.y);
+ static double distanceSquared(Vector v1, Vector v2) {
+ double dx = (v1.x - v2.x);
+ double dy = (v1.y - v2.y);
return dx * dx + dy * dy;
}
/**
* Return the distance between the two given vectors.
*/
- static num distance(Vector v1, Vector v2) {
+ static double distance(Vector v1, Vector v2) {
return Math.sqrt(distanceSquared(v1, v2));
}
/** Returns the closest value to [a] that is in between [low] and [high] */
- static num clamp(num a, num low, num high) {
+ static double clamp(double a, double low, double high) {
return Math.max(low, Math.min(a, high));
}
@@ -65,17 +65,17 @@
* from [toMin] and [toMax]. For example, given a [val] of 2 in the
* "from range" of 0-4, and a "to range" of 10-20, would return 15.
*/
- static num translateAndScale(num val, num fromMin, num fromMax, num toMin,
- num toMax) {
- final num mult = (val - fromMin) / (fromMax - fromMin);
- final num res = toMin + mult * (toMax - toMin);
+ static double translateAndScale(double val, double fromMin, double fromMax,
+ double toMin, double toMax) {
+ final double mult = (val - fromMin) / (fromMax - fromMin);
+ final double res = toMin + mult * (toMax - toMin);
return res;
}
/** Convert from [deg] degrees to radians. */
- static num degToRad(num deg) => (Math.PI / 180.0) * deg;
+ static double degToRad(double deg) => (Math.PI / 180.0) * deg;
/** Convert from [rad] radians to degrees. */
- static num radToDeg(num rad) => (180.0 / Math.PI) * rad;
+ static double radToDeg(double rad) => (180.0 / Math.PI) * rad;
}
</pre>
</div>
@@ -98,51 +98,51 @@
<h3>Static Methods</h3>
<div class="method"><h4 id="distanceSquared">
<button class="show-code">Code</button>
-num <strong>distanceSquared</strong>(<a href="../box2d/Vector.html">Vector</a> v1, <a href="../box2d/Vector.html">Vector</a> v2) <a class="anchor-link" href="#distanceSquared"
+double <strong>distanceSquared</strong>(<a href="../box2d/Vector.html">Vector</a> v1, <a href="../box2d/Vector.html">Vector</a> v2) <a class="anchor-link" href="#distanceSquared"
title="Permalink to MathBox.distanceSquared">#</a></h4>
<div class="doc">
<p>Return the distance between the two given vectors, but squared.</p>
<pre class="source">
-static num distanceSquared(Vector v1, Vector v2) {
- num dx = (v1.x - v2.x);
- num dy = (v1.y - v2.y);
+static double distanceSquared(Vector v1, Vector v2) {
+ double dx = (v1.x - v2.x);
+ double dy = (v1.y - v2.y);
return dx * dx + dy * dy;
}
</pre>
</div>
</div>
<div class="method"><h4 id="distance">
<button class="show-code">Code</button>
-num <strong>distance</strong>(<a href="../box2d/Vector.html">Vector</a> v1, <a href="../box2d/Vector.html">Vector</a> v2) <a class="anchor-link" href="#distance"
+double <strong>distance</strong>(<a href="../box2d/Vector.html">Vector</a> v1, <a href="../box2d/Vector.html">Vector</a> v2) <a class="anchor-link" href="#distance"
title="Permalink to MathBox.distance">#</a></h4>
<div class="doc">
<p>Return the distance between the two given vectors.</p>
<pre class="source">
-static num distance(Vector v1, Vector v2) {
+static double distance(Vector v1, Vector v2) {
return Math.sqrt(distanceSquared(v1, v2));
}
</pre>
</div>
</div>
<div class="method"><h4 id="clamp">
<button class="show-code">Code</button>
-num <strong>clamp</strong>(num a, num low, num high) <a class="anchor-link" href="#clamp"
+double <strong>clamp</strong>(double a, double low, double high) <a class="anchor-link" href="#clamp"
title="Permalink to MathBox.clamp">#</a></h4>
<div class="doc">
<p>Returns the closest value to
<span class="param">a</span> that is in between
<span class="param">low</span> and
<span class="param">high</span> </p>
<pre class="source">
-static num clamp(num a, num low, num high) {
+static double clamp(double a, double low, double high) {
return Math.max(low, Math.min(a, high));
}
</pre>
</div>
</div>
<div class="method"><h4 id="translateAndScale">
<button class="show-code">Code</button>
-num <strong>translateAndScale</strong>(num val, num fromMin, num fromMax, num toMin, num toMax) <a class="anchor-link" href="#translateAndScale"
+double <strong>translateAndScale</strong>(double val, double fromMin, double fromMax, double toMin, double toMax) <a class="anchor-link" href="#translateAndScale"
title="Permalink to MathBox.translateAndScale">#</a></h4>
<div class="doc">
<p>Given a value within the range specified by
@@ -155,36 +155,36 @@
<span class="param">val</span> of 2 in the
"from range" of 0-4, and a "to range" of 10-20, would return 15.</p>
<pre class="source">
-static num translateAndScale(num val, num fromMin, num fromMax, num toMin,
- num toMax) {
- final num mult = (val - fromMin) / (fromMax - fromMin);
- final num res = toMin + mult * (toMax - toMin);
+static double translateAndScale(double val, double fromMin, double fromMax,
+ double toMin, double toMax) {
+ final double mult = (val - fromMin) / (fromMax - fromMin);
+ final double res = toMin + mult * (toMax - toMin);
return res;
}
</pre>
</div>
</div>
<div class="method"><h4 id="degToRad">
<button class="show-code">Code</button>
-num <strong>degToRad</strong>(num deg) <a class="anchor-link" href="#degToRad"
+double <strong>degToRad</strong>(double deg) <a class="anchor-link" href="#degToRad"
title="Permalink to MathBox.degToRad">#</a></h4>
<div class="doc">
<p>Convert from
<span class="param">deg</span> degrees to radians. </p>
<pre class="source">
-static num degToRad(num deg) =&gt; (Math.PI / 180.0) * deg;
+static double degToRad(double deg) =&gt; (Math.PI / 180.0) * deg;
</pre>
</div>
</div>
<div class="method"><h4 id="radToDeg">
<button class="show-code">Code</button>
-num <strong>radToDeg</strong>(num rad) <a class="anchor-link" href="#radToDeg"
+double <strong>radToDeg</strong>(double rad) <a class="anchor-link" href="#radToDeg"
title="Permalink to MathBox.radToDeg">#</a></h4>
<div class="doc">
<p>Convert from
<span class="param">rad</span> radians to degrees. </p>
<pre class="source">
-static num radToDeg(num rad) =&gt; (180.0 / Math.PI) * rad;
+static double radToDeg(double rad) =&gt; (180.0 / Math.PI) * rad;
</pre>
</div>
</div>
Oops, something went wrong.

0 comments on commit 5ba30da

Please sign in to comment.