-
-
Save aj07mm/3f1ad617100484849b09 to your computer and use it in GitHub Desktop.
closure mongoose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CalcTrack = function(){ | |
this.isInsideTheCircunference = function(track, stop, radius){ | |
var trackC1 = track.posicao[0]; | |
var trackC2 = track.posicao[1]; | |
var stopC1 = stop.posicao[0]; | |
var stopC2 = stop.posicao[1]; | |
if(Math.sqrt(Math.pow(trackC1-trackC2,2) + Math.pow(stopC1-stopC2,2)) <= radius){ | |
return true; | |
} | |
return false; | |
}; | |
this.checkTrackInEachStop = function(track, stops){ | |
for (var i = 0;i<stops.length;i++){ | |
if(!this.isInsideTheCircunference(track, stops[i])){ | |
//do somethikng | |
} | |
} | |
} | |
this.doTheMath = function(tracks, stops){ | |
for (var i = 0;i<tracks.length;i++){ | |
this.checkTrackInEachStop(tracks[i], stops); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment