Well, this was fun. I write a question, go teach class, and come back to a very interesting conversation.
Thanks all. be well, randy www.classroomFocusedSoftware.com > On Nov 29, 2016, at 1:24 PM, hh <h...@hyperhh.de> wrote: > > I should have better used the wording > "graphic of type" than "graphic of style" > because we can > set the style of grc 1 to "polygon" > for example (the function again, just for the completeness here): > > on mouseUp > if there is no grc "poly" then create grc "poly" > set style of grc "poly" to "polygon" > -- 7 vertices, 1 vertix at 12 o'clock, radius 42, loc (100,100) > set points of grc "poly" to regularPoints(7,42,100,100) > set foreColor of grc "poly" to "0,128,128" -- teal > set lineSize of grc "poly" to 2 > end mouseUp > > -- N is the number of vertices > -- x0,y0 is the center of the polygon > -- r is the radius of the polygon > -- b is the angle of rotation in degrees > -- (positive b turns clockwise, negative b turns ccw) > function regularPoints n,r,x0,y0,b > put 2*pi/n into cn > -- n vertices --> n+1 points if 'closed' polygon > -- usually done by setting last=first > -- This is here true as sin(0)=sin(2*pi) and cos(0)=cos(2*pi) > put empty into pts > if b=0 or b is empty then > ## compute unrotated n+1 vertices of the n-sided regular polygon > repeat with j=0 to n > put CR & (round(r*sin(j*cn)+x0),round(-r*cos(j*cn)+y0)) after pts > end repeat > else > ## compute *rotated* n+1 vertices of the n-sided regular polygon > put sin(pi*b/180) into s; put cos(pi*b/180) into c > repeat with j=0 to n > put round( r*sin(j*cn)) into sx; put round(-r*cos(j*cn)) into sy > put CR & ( (round(x0+c*sx-s*sy),round(y0+c*sy+s*sx)) ) after pts > end repeat > end if > return char 2 to -1 of pts > end regularPoints > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode