js-2dmath
Version:
Fast 2d geometry math: Vector2, Rectangle, Circle, Matrix2x3 (2D transformation), Circle, BoundingBox, Line2, Segment2, Intersections, Distances, Transitions (animation/tween), Random numbers, Noise
43 lines (36 loc) • 1.26 kB
JavaScript
// todo generator
var js2math = require("./index.js");
["Triangle", "Rectangle", "Circle", "AABB2", "Polygon"].forEach(function(geom) {
["isVec2Inside", "area", "perimeter", "contains"].forEach(function(fname) {
if (!js2math[geom][fname]) {
console.log(geom+"."+fname);
}
});
});
exit();
["Triangle", "Rectangle", "Circle", "Polygon"].forEach(function(geom) {
if (!js2math.AABB2["from" + geom]) {
console.log("AABB2.from" + geom);
}
});
// todo list
["Vec2", "Line2", "Segment2", "Rectangle", "Circle", "AABB2"].forEach(function(v) {
//console.log(v, js2math[v]);
if("function" !== typeof js2math[v].distance) {
console.log(v, " distance is missing");
}
if("function" !== typeof js2math[v].length) {
console.log(v, " length is missing");
}
if("function" !== typeof js2math[v].area) {
console.log(v, " area is missing");
}
["Vec2", "Line2", "Segment2", "Rectangle", "Circle"].forEach(function(v2) {
if (v == v2) {
return;
}
if (!js2math.Intersection[v.toLowerCase() + "_" + v2.toLowerCase()]) {
console.log(v.toLowerCase() + "_" + v2.toLowerCase(), " intersection is missing");
}
});
});