Created
January 6, 2012 23:25
-
-
Save huckfinnaafb/1572978 to your computer and use it in GitHub Desktop.
This file contains 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
function toIndice(vec, gw) { | |
return ((vec.y) * gw + vec.x); | |
} | |
function isUnique(array) { | |
var uniques = _.uniq(array); | |
return array.length === uniques.length; | |
}; | |
var i, vectors = [], indices = []; | |
for (i = 0; i < 1000; i += 1) { | |
vectors.push(new Vector(0, 0, 0)); | |
} | |
var j; | |
for (j = 0; j < vectors.length; j += 1) { | |
vectors[j].x = j; | |
indices.push(toIndice(vectors[j], 10)); | |
} | |
var k; | |
for (k = 0; k < vectors.length; k += 1) { | |
vectors[k].y = k; | |
indices.push(toIndice(vectors[k], 10)); | |
} | |
console.log(isUnique(indices)); | |
=> false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment