Question

I created a polygon with equal sides(square) using booard.create("polygon",[p1,p2]) I want to add ticks in every border line of that polygon. How can it be done, I know it can be done if using lines and segments to create that shape, but I did it using polygon, any ideas?

Was it helpful?

Solution

One has access to the edges of a polygon via borders and can create ticks for each of the edges:

var pol = board.create("polygon",[p1,p2]);
var i, ti = [];
for (i = 0; i < pol.borders.length; ++i) {
    ti.push(board.create('ticks', [pol.borders[i]]));
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top