cg (computation geometry) algorithms templates for JavaScript