I found a good example of how to find the center point of a polygon ( and here in JS ):
-> See this jsfiddle example
So with this polygon
var polygon = [ {'x':770, 'y':400}, {'x':529, 'y':643}, {'x':320, 'y':494}, {'x':424, 'y':381}, {'x':459, 'y':369} ];
I have to find the center like this:
var con = new Contour(); con.pts = polygon; document.write(con.centroid)
But con.centroid is undefined .
What am I doing wrong? Thanks in advance!
javascript prototype canvas
koko
source share