Protects against NaN in some trajectories.
authordsc <david.schoonover@gmail.com>
Fri, 11 Mar 2011 05:37:28 +0000 (21:37 -0800)
committerdsc <david.schoonover@gmail.com>
Fri, 11 Mar 2011 05:37:28 +0000 (21:37 -0800)
pavement.py
src/ezl/math/circle.cjs
src/ezl/math/line.cjs
www/scripts.html

index 21ca152..e676934 100755 (executable)
@@ -183,7 +183,8 @@ def clean():
 
 
 @task
-@needs('compress')
+# @needs('compress')
+@needs('build')
 @cmdopts([
     ('exclude=', 'x', 'Exclude listed files (separate with commas).')
 ])
index d5b3227..2704fbc 100644 (file)
@@ -1,8 +1,10 @@
 var Y = require('Y').Y
 ,   Vec = require('ezl/math/vec').Vec
+
 ,   _X = 0, _Y = 1
 ,
 
+
 Circle =
 exports['Circle'] =
 Y.subclass('Circle', {
@@ -38,7 +40,10 @@ Y.subclass('Circle', {
     
     timeToMove : function timeToMove(dx,dy){
         if (dx instanceof Array) { dy=dx[1]; dx=dx[0]; }
-        return Math.abs( Math.acos(dx/this.radius) + Math.asin(dy/this.radius) ) * 0.5; // see note at iparametric
+        var _dx = Math.acos(dx/this.radius)
+        ,   _dy = Math.asin(dy/this.radius)
+        ;
+        return Math.abs((isNaN(_dx) || isNaN(_dy)) ? (isNaN(_dx) ? _dy : _dx) : ((_dx + _dy) * 0.5)); // see note at iparametric
     },
     
     pointAtX : function pointAtX(x){ return this.parametric(Math.acos((x - this.x)/this.radius)); },
index 00e0575..c21edcb 100644 (file)
@@ -66,7 +66,10 @@ Vec.subclass('Line', {
      */
     timeToMove : function timeToMove(dx,dy){
         if (dx instanceof Array) { dy=dx[1]; dx=dx[0]; }
-        return (Math.abs(dx/this.pa) + Math.abs(dy/this.pb)) * 0.5; // see note at iparametric
+        var _dx = Math.abs(dx/this.pa)
+        ,   _dy = Math.abs(dy/this.pb)
+        ;
+        return (isNaN(_dx) || isNaN(_dy)) ? (isNaN(_dx) ? _dy : _dx) : ((_dx + _dy) * 0.5); // see note at iparametric
     },
     
     parametric : function parametric(t){
index 2222c8b..d71deaf 100644 (file)
@@ -1,5 +1,5 @@
 <div id="scripts">
 <!--# include file="build/versioned-build.html" -->
-<!--# include file="build/versioned-app.html" -->
+<!--# include file="build/versioned-deps.html" -->
 <!--# include file="ga.html" -->
 </div>