is it possible after creating the first polygon and filling it, to just shift the whole thing over and fill it again in a different spot? or any other alternative to calculating each point for every hex?
Thanks!
Code: Select all
public handler OnPaint()
variable tH as Number
variable tW as Number
variable tS as Number
variable tX0 as Number
variable tX1 as Number
variable tX2 as Number
variable tX3 as Number
variable tY0 as Number
variable tY1 as Number
variable tY2 as Number
variable tHM as Number
variable tWM as Number
variable tHexPath as Path
put my height into tHM
put my width into tWM
set the paint of this canvas to my foreground paint
put (the minimum of tHM and tWM)/7 into tH
put tH * 1.1547 into tW
put tH * 0.5774 into tS
put (tWM/2) - (tW/2) into tX0
put tX0 + ((tW-tS)/2) into tX1
put tX1 + tS into tX2
put tX0 + tW into tX3
put (tHM/2) - (tH/2) into tY0
put tY0 + (tH/2) into tY1
put tY0 + tH into tY2
put polygon path with points [point [tX0,tY1],point [tX1,tY0],point [tX2,tY0],point [tX3,tY1],point [tX2,tY2],point [tX1,tY2]] into tHexPath
add tHexPath to this canvas
fill this canvas
end handler