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]]));
}