added reference to d3.js, added error handling to make sure points which are passed make a regular convex polygon.