cg (computational geometry) algorithms templates for JavaScript