https://codepen.io/ysraeljmm/pen/rrbrQJ Function toVertex. The first parameter is an element of type SVG, it can be a path, rect, circle, etc. The second parameter is the distance of segments. Returns an array as a javascript object, which is generally used in Phaser or matter js.