Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/Canvas+Rotation?V=11
QUERY_STRINGV=11
CONTENT_TYPE
DOCUMENT_URI/revision/Canvas+Rotation
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR108.162.216.121
REMOTE_PORT25186
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR18.118.30.253
HTTP_CF_RAY87f9d5480f0ae27f-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_CF_CONNECTING_IP18.118.30.253
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit {Canvas Rotation} \[Keith\ Vetter\]\ 2003-03-19\ :\ for\ another\ project\ I\ needed\ to\ rotate\ \nand\ scale\ items\ on\ a\ canvas.\ Tcl\ will\ do\ the\ scaling\ for\ you\ (mostly)\nand\ I\ wrote\ the\ following\ routines\ to\ do\ the\ rotation.\n\nIt\ works\ by\ rotating\ clockwise\ the\ coordinates\ of\ an\ item\ by\ some\ angle\ about\nan\ arbitrary\ origin.\ This\ works\ well\ for\ polygons\ and\ lines\ but\ not\nfor\ ovals,\ rectangles,\ arcs\ or\ text.\ If\ you\ really\ need\ rotation\ of\ ovals,\nrectangles\ and\ arcs\ you\ could\ first\ convert\ them\ into\ polygons\ \n(see\ \[Regular\ polygons\]\ for\ the\ code).\n\nThe\ demonstration\ code\ shows\ how\ it\ works.\ It\ draws\ a\ complex\nitem\ on\ the\ screen\ (the\ flag\ man\ from\ \[Flag\ Signalling\])\ and\nlets\ you\ rotate\ about\ some\ points.\ It\ contains\ mostly\ polygons\nand\ lines\ but\ also\ an\ oval,\ arc,\ rectangle\ and\ text\ so\ you\ can\nsee\ how\ it\ fails\ with\ those\ items.\n\n----\n\[RS\]\ notes\ that\ rectangles\ can\ be\ converted\ to\ polygons\ in\ a\ loss-free\ way,\ and\ finely\ rotated\ thereafter.\ Raw\ sketch:\n\ proc\ rect2poly\ \{w\ item\}\ \{\n\ \ \ \ foreach\ \{x0\ y0\ x1\ y1\}\ \[\$w\ coords\ \$item\]\ break\n\ \ \ \ \$w\ delete\ \$item\n\ \ \ \ \$w\ create\ poly\ \$x0\ \$y0\ \$x0\ \$y1\ \$x1\ \$y1\ \$x1\ \$y0\ \;#\ need\ -fill\ etc.\ attributes\ here\n\ \}\nfor\ a\ more\ detailed\ example:\ \[Rectangle\ Conversion\]\n----\n\n\n\ #----------------------------------------------------------------------\n\ #\n\ #\ RotateItem\ --\ Rotates\ a\ canvas\ item\ any\ angle\ about\ an\ arbitrary\ point.\n\ #\ Works\ by\ rotating\ the\ coordinates\ of\ the\ object.\ Thus\ it\ works\ with:\n\ #\ \ o\ polygon\n\ #\ \ o\ line\n\ #\ It\ DOES\ NOT\ work\ correctly\ with:\n\ #\ \ o\ rectangle\n\ #\ \ o\ oval\ and\ arcs\n\ #\ \ o\ text\n\ #\ \n\ #\ Parameters:\n\ #\ \ \ \ \ \ \ w\ -\ Path\ name\ of\ the\ canvas\n\ #\ \ \ \ \ \ \ tagOrId\ -\ what\ to\ rotate\ --\ may\ be\ composite\ items\n\ #\ \ \ \ \ \ \ Ox,\ Oy\ -\ origin\ to\ rotate\ around\n\ #\ \ \ \ \ \ \ angle\ -\ degrees\ clockwise\ to\ rotate\ by\n\ #\n\ #\ Results:\n\ #\ \ \ \ \ \ \ Returns\ nothing\n\ #\n\ #\ Side\ effects:\n\ #\ \ \ \ \ \ \ Rotates\ a\ canvas\ item\ by\ ANGLE\ degrees\ clockwise\n\ #\n\ #----------------------------------------------------------------------\n\ \n\ proc\ RotateItem\ \{w\ tagOrId\ Ox\ Oy\ angle\}\ \{\n\ \ \ \ set\ angle\ \[expr\ \{\$angle\ *\ atan(1)\ *\ 4\ /\ 180.0\}\]\ \;#\ Radians\n\ \ \ \ foreach\ id\ \[\$w\ find\ withtag\ \$tagOrId\]\ \{\ \ \ \ \ \;#\ Do\ each\ component\ separately\n\ \ \ \ \ \ \ \ set\ xy\ \{\}\n\ \ \ \ \ \ \ \ foreach\ \{x\ y\}\ \[\$w\ coords\ \$id\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ #\ rotates\ vector\ (Ox,Oy)->(x,y)\ by\ angle\ clockwise\n\n\ \ \ \ \ \ \ \ \ \ \ \ set\ x\ \[expr\ \{\$x\ -\ \$Ox\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Shift\ to\ origin\n\ \ \ \ \ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$y\ -\ \$Oy\}\]\n\n\ \ \ \ \ \ \ \ \ \ \ \ set\ xx\ \[expr\ \{\$x\ *\ cos(\$angle)\ -\ \$y\ *\ sin(\$angle)\}\]\ \;#\ Rotate\n\ \ \ \ \ \ \ \ \ \ \ \ set\ yy\ \[expr\ \{\$x\ *\ sin(\$angle)\ +\ \$y\ *\ cos(\$angle)\}\]\n\n\ \ \ \ \ \ \ \ \ \ \ \ set\ xx\ \[expr\ \{\$xx\ +\ \$Ox\}\]\ \ \ \ \ \ \ \ \ \ \ \;#\ Shift\ back\n\ \ \ \ \ \ \ \ \ \ \ \ set\ yy\ \[expr\ \{\$yy\ +\ \$Oy\}\]\n\ \ \ \ \ \ \ \ \ \ \ \ lappend\ xy\ \$xx\ \$yy\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \$w\ coords\ \$id\ \$xy\n\ \ \ \ \}\n\ \}\n\ \n\ ################################################################\n\ #\n\ #\ Demonstration\ code\n\ #\n\ \n\ \n\ proc\ Anchor\ \{w\ tagOrId\ where\}\ \{\n\ \ \ \ foreach\ \{x1\ y1\ x2\ y2\}\ \[\$w\ bbox\ \$tagOrId\]\ break\n\ \ \ \ if\ \{\[string\ first\ \"n\"\ \$where\]\ >\ -1\}\ \{\n\ \ \ \ \ \ \ \ set\ y\ \$y1\n\ \ \ \ \}\ elseif\ \{\[string\ first\ \"s\"\ \$where\]\ >\ -1\}\ \{\n\ \ \ \ \ \ \ \ set\ y\ \$y2\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ y\ \[expr\ \{(\$y1\ +\ \$y2)\ /\ 2.0\}\]\n\ \ \ \ \}\n\ \ \ \ if\ \{\[string\ first\ \"w\"\ \$where\]\ >\ -1\}\ \{\n\ \ \ \ \ \ \ \ set\ x\ \$x1\n\ \ \ \ \}\ elseif\ \{\[string\ first\ \"e\"\ \$where\]\ >\ -1\}\ \{\n\ \ \ \ \ \ \ \ set\ x\ \$x2\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \{(\$x1\ +\ \$x2)\ /\ 2.0\}\]\n\ \ \ \ \}\n\ \ \ \ return\ \[list\ \$x\ \$y\]\n\ \}\n\ proc\ flagman\ \{\}\ \{\n\ \ \ \ .c\ delete\ all\n\ \ \ \ .c\ create\ poly\ \{-20\ 100\ -5\ 100\ 0\ 50\ 5\ 100\ 20\ 100\ 25\ -4\ 0\ -10\n\ \ \ \ \ \ \ \ -25\ -4\}\ -fill\ white\ -tag\ poly\n\ \ \ \ .c\ create\ oval\ \{-10\ -29\ 10\ -5\}\ -fill\ orange\ \ -outline\ orange\ -tag\ poly\n\ \ \ \ .c\ create\ line\ \{-4\ -20\ -4\ -17\}\ -tag\ poly\n\ \ \ \ .c\ create\ line\ \{4\ \ -20\ \ 4\ -17\}\ -tag\ poly\n\ \ \ \ .c\ create\ arc\ -6\ -24\ 6\ -10\ -start\ 210\ -extent\ 125\ -style\ arc\ -tag\ poly\n\ \ \ \ .c\ create\ rect\ \{-9\ -29\ 9\ -24\}\ -fill\ green\ -outline\ green\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ -25\ 45\ -25\ 57\ -15\ 57\ -15\ 45\ -smo\ 1\ -fill\ orange\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{-20\ 0\ -25\ 0\ -25\ 48\ -15\ 48\ -15\ 0\}\ -fill\ grey95\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{-21\ 50\ -21\ 90\ -19\ 90\ -19\ 50\}\ -fill\ brown\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{-21\ 88\ -21\ 60\ 7\ 60\ 7\ 88\}\ -fill\ red\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{-21\ 60\ 7\ 60\ 7\ 88\}\ -fill\ yellow\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ 25\ 45\ 25\ 57\ 15\ 57\ 15\ 45\ -smooth\ 1\ -fill\ orange\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{20\ 0\ 25\ 0\ 25\ 48\ 15\ 48\ 15\ 0\}\ -fill\ grey95\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{21\ 50\ 21\ 90\ 19\ 90\ 19\ 50\}\ -fill\ brown\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{21\ 88\ 21\ 60\ -7\ 60\ -7\ 88\}\ -fill\ red\ \ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{21\ 60\ -7\ 60\ -7\ 88\}\ -fill\ yellow\ -tag\ poly\n\ \ \ \ .c\ create\ text\ 0\ 110\ -text\ \"Flag\ Man\"\ -anchor\ c\ -tag\ poly\n\ \ \ \ .c\ move\ poly\ 0\ -35.5\n\ \ \ \ \n\ \ \ \ bind\ .\ <Up>\ \ \ \{.c\ scale\ all\ 0\ 0\ 1.25\ 1.25\}\n\ \ \ \ bind\ .\ <Down>\ \{.c\ scale\ all\ 0\ 0\ 0.8\ 0.8\}\n\ \ \ \ bind\ .c\ <1>\ \ \ \{.c\ scale\ all\ 0\ 0\ 1.25\ 1.25\}\n\ \ \ \ bind\ .c\ <3>\ \ \ \{.c\ scale\ all\ 0\ 0\ 0.8\ 0.8\}\n\ \}\n\ \n\ proc\ Reset\ \{\}\ \{\n\ \ \ \ flagman\n\ \ \ \ DrawAnchor\n\ \}\n\ proc\ DrawAnchor\ \{args\}\ \{\n\ \ \ \ .c\ delete\ anchor\n\ \ \ \ foreach\ \{x\ y\}\ \[Anchor\ .c\ poly\ \$::anchor\]\ break\n\ \ \ \ set\ x0\ \[expr\ \{\$x\ -\ 3\}\]\;\ set\ y0\ \[expr\ \{\$y\ -\ 3\}\]\n\ \ \ \ set\ x1\ \[expr\ \{\$x\ +\ 3\}\]\;\ set\ y1\ \[expr\ \{\$y\ +\ 3\}\]\n\ \ \ \ .c\ create\ oval\ \$x0\ \$y0\ \$x1\ \$y1\ -tag\ anchor\ -fill\ black\n\ \}\n\ proc\ Recenter\ \{W\ h\ w\}\ \{\n\ \ \ \ set\ h\ \[expr\ \{\$h\ /\ 2.0\}\]\ \;\ set\ w\ \[expr\ \{\$w\ /\ 2.0\}\]\n\ \ \ \ \$W\ config\ -scrollregion\ \[list\ -\$w\ -\$h\ \$w\ \$h\]\n\ \}\n\ proc\ Doit\ \{\}\ \{\n\ \ \ \ foreach\ \{Ox\ Oy\}\ \[Anchor\ .c\ anchor\ c\]\ break\ \ \;#\ Get\ rotation\ point\n\ \ \ \ RotateItem\ .c\ poly\ \$Ox\ \$Oy\ \$::angle\n\ \}\n\ \n\ canvas\ .c\ -width\ 300\ -height\ 300\ -bd\ 2\ -relief\ raised\n\ bind\ .c\ <Configure>\ \{Recenter\ %W\ %h\ %w\}\n\ \n\ scale\ .angle\ -orient\ horizontal\ -label\ \"Rotation\ angle\"\ -variable\ angle\ \\\n\ \ \ \ -from\ -180\ -to\ 180\ -relief\ ridge\n\ labelframe\ .l\ -text\ \"Rotation\ point\"\n\ foreach\ \{a1\ a2\ a3\}\ \{nw\ n\ ne\ w\ c\ e\ sw\ s\ se\}\ \{\n\ \ \ \ radiobutton\ .l.\$a1\ -text\ \$a1\ -variable\ anchor\ -value\ \$a1\ -anchor\ w\ -command\ DrawAnchor\n\ \ \ \ radiobutton\ .l.\$a2\ -text\ \$a2\ -variable\ anchor\ -value\ \$a2\ -anchor\ w\ -command\ DrawAnchor\n\ \ \ \ radiobutton\ .l.\$a3\ -text\ \$a3\ -variable\ anchor\ -value\ \$a3\ -anchor\ w\ -command\ DrawAnchor\n\ \ \ \ grid\ .l.\$a1\ .l.\$a2\ .l.\$a3\ -sticky\ ew\n\ \}\n\ button\ .rotate\ -text\ Rotate\ -command\ Doit\n\ button\ .reset\ -text\ Reset\ -command\ Reset\n\ image\ create\ photo\ ::img::blank\ -width\ 1\ -height\ 1\n\ button\ .about\ -image\ ::img::blank\ -highlightthickness\ 0\ -command\ \\\n\ \ \ \ \{tk_messageBox\ -message\ \"Canvas\ Rotation\\nby\ Keith\ Vetter,\ March\ 2003\"\}\n\ place\ .about\ -in\ .\ -relx\ 1\ -rely\ 1\ -anchor\ se\n\ \n\ grid\ .c\ -\ -\ -\ -row\ 0\ -sticky\ news\n\ grid\ .l\ .angle\ .rotate\n\ grid\ ^\ \ ^\ \ \ \ \ \ .reset\n\ grid\ rowconfigure\ .\ 0\ -weight\ 1\n\ grid\ columnconfigure\ .\ 3\ -weight\ 1\n\ grid\ config\ .angle\ -sticky\ n\ -pady\ 7\n\ \n\ set\ anchor\ c\n\ set\ angle\ 30\n\ Reset\n\n----\nFor\ use\ with\ animations,\ speed\ is\ an\ issue.\ Especially\ for\ use\ in\ mobile\ systems\ without\ floating\ point\ processor.\nFor\ this\ purpose,\ goniometrics\ could\ be\ replaced\ by\ look-ups\ with\ 5\ entries\ (1-5\ degrees,\ beyond\ 5\ with\ gonio).\nHowever,\ the\ simple\ improvement\ below\ may\ be\ sufficient\ and\ halves\ execution\ time\ (measured\ with\ ARM9\ system,\ w/o\ FPU)\ -\ \[RJM\].\n\ #\ First\ improvement\ step:\ goniometrics\ out\ of\ loop\n\ proc\ object_rotate\ \{w\ tag\ Ox\ Oy\ angle\}\ \{\n\ \ \ \ #foreach\ \{Ox\ Oy\}\ \[object_center\ \$w\ \$tag\]\ break\n\ \ \ \ set\ angle\ \[expr\ \{\$angle\ *\ atan(1)\ /\ 45.0\}\]\ \;#\ Radians\n\ \ \ \ set\ sin\ \[expr\ \{sin(\$angle)\}\]\n\ \ \ \ set\ cos\ \[expr\ \{cos(\$angle)\}\]\n\ \ \ \ foreach\ id\ \[\$w\ find\ withtag\ \$tag\]\ \{\ \ \ \ \ \;#\ Do\ each\ component\ separately\n\ \ \ \ \ \ \ \ set\ xy\ \{\}\n\ \ \ \ \ \ \ \ foreach\ \{x\ y\}\ \[\$w\ coords\ \$id\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ #\ rotates\ vector\ (Ox,Oy)->(x,y)\ by\ angle\ clockwise\n\ \ \ \ \ \ \ \ \ \ \ \ set\ x\ \[expr\ \{\$x\ -\ \$Ox\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Shift\ to\ origin\n\ \ \ \ \ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$y\ -\ \$Oy\}\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ xx\ \[expr\ \{\$x\ *\ \$cos\ -\ \$y\ *\ \$sin\ +\ \$Ox\}\]\ \;#\ Rotate\ and\ shift\ back\n\ \ \ \ \ \ \ \ \ \ \ \ set\ yy\ \[expr\ \{\$x\ *\ \$sin\ +\ \$y\ *\ \$cos\ +\ \$Oy\}\]\n\ \ \ \ \ \ \ \ \ \ \ \ lappend\ xy\ \$xx\ \$yy\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \$w\ coords\ \$id\ \$xy\n\ \ \ \ \}\n\ \}\n\n----\n\n\n\n\n\n\n======\n----\n\n***Screenshots***\n\n\n\n\n\n\n\n\[http://farm5.static.flickr.com/4033/4690372933_cab9267ef2.jpg\]\n\n\n\n\n\n\n\n\ \ \ \ \ \ \ \n\n\n\[gold\]\ added\ pix\ \n\n----\n\n\n\n\n\n\n\n\n\n----\n!!!!!!\n%|\ \[Category\ Graphics\]\ |%\n!!!!!! regexp2} CALL {my render {Canvas Rotation} \[Keith\ Vetter\]\ 2003-03-19\ :\ for\ another\ project\ I\ needed\ to\ rotate\ \nand\ scale\ items\ on\ a\ canvas.\ Tcl\ will\ do\ the\ scaling\ for\ you\ (mostly)\nand\ I\ wrote\ the\ following\ routines\ to\ do\ the\ rotation.\n\nIt\ works\ by\ rotating\ clockwise\ the\ coordinates\ of\ an\ item\ by\ some\ angle\ about\nan\ arbitrary\ origin.\ This\ works\ well\ for\ polygons\ and\ lines\ but\ not\nfor\ ovals,\ rectangles,\ arcs\ or\ text.\ If\ you\ really\ need\ rotation\ of\ ovals,\nrectangles\ and\ arcs\ you\ could\ first\ convert\ them\ into\ polygons\ \n(see\ \[Regular\ polygons\]\ for\ the\ code).\n\nThe\ demonstration\ code\ shows\ how\ it\ works.\ It\ draws\ a\ complex\nitem\ on\ the\ screen\ (the\ flag\ man\ from\ \[Flag\ Signalling\])\ and\nlets\ you\ rotate\ about\ some\ points.\ It\ contains\ mostly\ polygons\nand\ lines\ but\ also\ an\ oval,\ arc,\ rectangle\ and\ text\ so\ you\ can\nsee\ how\ it\ fails\ with\ those\ items.\n\n----\n\[RS\]\ notes\ that\ rectangles\ can\ be\ converted\ to\ polygons\ in\ a\ loss-free\ way,\ and\ finely\ rotated\ thereafter.\ Raw\ sketch:\n\ proc\ rect2poly\ \{w\ item\}\ \{\n\ \ \ \ foreach\ \{x0\ y0\ x1\ y1\}\ \[\$w\ coords\ \$item\]\ break\n\ \ \ \ \$w\ delete\ \$item\n\ \ \ \ \$w\ create\ poly\ \$x0\ \$y0\ \$x0\ \$y1\ \$x1\ \$y1\ \$x1\ \$y0\ \;#\ need\ -fill\ etc.\ attributes\ here\n\ \}\nfor\ a\ more\ detailed\ example:\ \[Rectangle\ Conversion\]\n----\n\n\n\ #----------------------------------------------------------------------\n\ #\n\ #\ RotateItem\ --\ Rotates\ a\ canvas\ item\ any\ angle\ about\ an\ arbitrary\ point.\n\ #\ Works\ by\ rotating\ the\ coordinates\ of\ the\ object.\ Thus\ it\ works\ with:\n\ #\ \ o\ polygon\n\ #\ \ o\ line\n\ #\ It\ DOES\ NOT\ work\ correctly\ with:\n\ #\ \ o\ rectangle\n\ #\ \ o\ oval\ and\ arcs\n\ #\ \ o\ text\n\ #\ \n\ #\ Parameters:\n\ #\ \ \ \ \ \ \ w\ -\ Path\ name\ of\ the\ canvas\n\ #\ \ \ \ \ \ \ tagOrId\ -\ what\ to\ rotate\ --\ may\ be\ composite\ items\n\ #\ \ \ \ \ \ \ Ox,\ Oy\ -\ origin\ to\ rotate\ around\n\ #\ \ \ \ \ \ \ angle\ -\ degrees\ clockwise\ to\ rotate\ by\n\ #\n\ #\ Results:\n\ #\ \ \ \ \ \ \ Returns\ nothing\n\ #\n\ #\ Side\ effects:\n\ #\ \ \ \ \ \ \ Rotates\ a\ canvas\ item\ by\ ANGLE\ degrees\ clockwise\n\ #\n\ #----------------------------------------------------------------------\n\ \n\ proc\ RotateItem\ \{w\ tagOrId\ Ox\ Oy\ angle\}\ \{\n\ \ \ \ set\ angle\ \[expr\ \{\$angle\ *\ atan(1)\ *\ 4\ /\ 180.0\}\]\ \;#\ Radians\n\ \ \ \ foreach\ id\ \[\$w\ find\ withtag\ \$tagOrId\]\ \{\ \ \ \ \ \;#\ Do\ each\ component\ separately\n\ \ \ \ \ \ \ \ set\ xy\ \{\}\n\ \ \ \ \ \ \ \ foreach\ \{x\ y\}\ \[\$w\ coords\ \$id\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ #\ rotates\ vector\ (Ox,Oy)->(x,y)\ by\ angle\ clockwise\n\n\ \ \ \ \ \ \ \ \ \ \ \ set\ x\ \[expr\ \{\$x\ -\ \$Ox\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Shift\ to\ origin\n\ \ \ \ \ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$y\ -\ \$Oy\}\]\n\n\ \ \ \ \ \ \ \ \ \ \ \ set\ xx\ \[expr\ \{\$x\ *\ cos(\$angle)\ -\ \$y\ *\ sin(\$angle)\}\]\ \;#\ Rotate\n\ \ \ \ \ \ \ \ \ \ \ \ set\ yy\ \[expr\ \{\$x\ *\ sin(\$angle)\ +\ \$y\ *\ cos(\$angle)\}\]\n\n\ \ \ \ \ \ \ \ \ \ \ \ set\ xx\ \[expr\ \{\$xx\ +\ \$Ox\}\]\ \ \ \ \ \ \ \ \ \ \ \;#\ Shift\ back\n\ \ \ \ \ \ \ \ \ \ \ \ set\ yy\ \[expr\ \{\$yy\ +\ \$Oy\}\]\n\ \ \ \ \ \ \ \ \ \ \ \ lappend\ xy\ \$xx\ \$yy\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \$w\ coords\ \$id\ \$xy\n\ \ \ \ \}\n\ \}\n\ \n\ ################################################################\n\ #\n\ #\ Demonstration\ code\n\ #\n\ \n\ \n\ proc\ Anchor\ \{w\ tagOrId\ where\}\ \{\n\ \ \ \ foreach\ \{x1\ y1\ x2\ y2\}\ \[\$w\ bbox\ \$tagOrId\]\ break\n\ \ \ \ if\ \{\[string\ first\ \"n\"\ \$where\]\ >\ -1\}\ \{\n\ \ \ \ \ \ \ \ set\ y\ \$y1\n\ \ \ \ \}\ elseif\ \{\[string\ first\ \"s\"\ \$where\]\ >\ -1\}\ \{\n\ \ \ \ \ \ \ \ set\ y\ \$y2\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ y\ \[expr\ \{(\$y1\ +\ \$y2)\ /\ 2.0\}\]\n\ \ \ \ \}\n\ \ \ \ if\ \{\[string\ first\ \"w\"\ \$where\]\ >\ -1\}\ \{\n\ \ \ \ \ \ \ \ set\ x\ \$x1\n\ \ \ \ \}\ elseif\ \{\[string\ first\ \"e\"\ \$where\]\ >\ -1\}\ \{\n\ \ \ \ \ \ \ \ set\ x\ \$x2\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ set\ x\ \[expr\ \{(\$x1\ +\ \$x2)\ /\ 2.0\}\]\n\ \ \ \ \}\n\ \ \ \ return\ \[list\ \$x\ \$y\]\n\ \}\n\ proc\ flagman\ \{\}\ \{\n\ \ \ \ .c\ delete\ all\n\ \ \ \ .c\ create\ poly\ \{-20\ 100\ -5\ 100\ 0\ 50\ 5\ 100\ 20\ 100\ 25\ -4\ 0\ -10\n\ \ \ \ \ \ \ \ -25\ -4\}\ -fill\ white\ -tag\ poly\n\ \ \ \ .c\ create\ oval\ \{-10\ -29\ 10\ -5\}\ -fill\ orange\ \ -outline\ orange\ -tag\ poly\n\ \ \ \ .c\ create\ line\ \{-4\ -20\ -4\ -17\}\ -tag\ poly\n\ \ \ \ .c\ create\ line\ \{4\ \ -20\ \ 4\ -17\}\ -tag\ poly\n\ \ \ \ .c\ create\ arc\ -6\ -24\ 6\ -10\ -start\ 210\ -extent\ 125\ -style\ arc\ -tag\ poly\n\ \ \ \ .c\ create\ rect\ \{-9\ -29\ 9\ -24\}\ -fill\ green\ -outline\ green\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ -25\ 45\ -25\ 57\ -15\ 57\ -15\ 45\ -smo\ 1\ -fill\ orange\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{-20\ 0\ -25\ 0\ -25\ 48\ -15\ 48\ -15\ 0\}\ -fill\ grey95\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{-21\ 50\ -21\ 90\ -19\ 90\ -19\ 50\}\ -fill\ brown\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{-21\ 88\ -21\ 60\ 7\ 60\ 7\ 88\}\ -fill\ red\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{-21\ 60\ 7\ 60\ 7\ 88\}\ -fill\ yellow\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ 25\ 45\ 25\ 57\ 15\ 57\ 15\ 45\ -smooth\ 1\ -fill\ orange\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{20\ 0\ 25\ 0\ 25\ 48\ 15\ 48\ 15\ 0\}\ -fill\ grey95\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{21\ 50\ 21\ 90\ 19\ 90\ 19\ 50\}\ -fill\ brown\ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{21\ 88\ 21\ 60\ -7\ 60\ -7\ 88\}\ -fill\ red\ \ -tag\ poly\n\ \ \ \ .c\ create\ poly\ \{21\ 60\ -7\ 60\ -7\ 88\}\ -fill\ yellow\ -tag\ poly\n\ \ \ \ .c\ create\ text\ 0\ 110\ -text\ \"Flag\ Man\"\ -anchor\ c\ -tag\ poly\n\ \ \ \ .c\ move\ poly\ 0\ -35.5\n\ \ \ \ \n\ \ \ \ bind\ .\ <Up>\ \ \ \{.c\ scale\ all\ 0\ 0\ 1.25\ 1.25\}\n\ \ \ \ bind\ .\ <Down>\ \{.c\ scale\ all\ 0\ 0\ 0.8\ 0.8\}\n\ \ \ \ bind\ .c\ <1>\ \ \ \{.c\ scale\ all\ 0\ 0\ 1.25\ 1.25\}\n\ \ \ \ bind\ .c\ <3>\ \ \ \{.c\ scale\ all\ 0\ 0\ 0.8\ 0.8\}\n\ \}\n\ \n\ proc\ Reset\ \{\}\ \{\n\ \ \ \ flagman\n\ \ \ \ DrawAnchor\n\ \}\n\ proc\ DrawAnchor\ \{args\}\ \{\n\ \ \ \ .c\ delete\ anchor\n\ \ \ \ foreach\ \{x\ y\}\ \[Anchor\ .c\ poly\ \$::anchor\]\ break\n\ \ \ \ set\ x0\ \[expr\ \{\$x\ -\ 3\}\]\;\ set\ y0\ \[expr\ \{\$y\ -\ 3\}\]\n\ \ \ \ set\ x1\ \[expr\ \{\$x\ +\ 3\}\]\;\ set\ y1\ \[expr\ \{\$y\ +\ 3\}\]\n\ \ \ \ .c\ create\ oval\ \$x0\ \$y0\ \$x1\ \$y1\ -tag\ anchor\ -fill\ black\n\ \}\n\ proc\ Recenter\ \{W\ h\ w\}\ \{\n\ \ \ \ set\ h\ \[expr\ \{\$h\ /\ 2.0\}\]\ \;\ set\ w\ \[expr\ \{\$w\ /\ 2.0\}\]\n\ \ \ \ \$W\ config\ -scrollregion\ \[list\ -\$w\ -\$h\ \$w\ \$h\]\n\ \}\n\ proc\ Doit\ \{\}\ \{\n\ \ \ \ foreach\ \{Ox\ Oy\}\ \[Anchor\ .c\ anchor\ c\]\ break\ \ \;#\ Get\ rotation\ point\n\ \ \ \ RotateItem\ .c\ poly\ \$Ox\ \$Oy\ \$::angle\n\ \}\n\ \n\ canvas\ .c\ -width\ 300\ -height\ 300\ -bd\ 2\ -relief\ raised\n\ bind\ .c\ <Configure>\ \{Recenter\ %W\ %h\ %w\}\n\ \n\ scale\ .angle\ -orient\ horizontal\ -label\ \"Rotation\ angle\"\ -variable\ angle\ \\\n\ \ \ \ -from\ -180\ -to\ 180\ -relief\ ridge\n\ labelframe\ .l\ -text\ \"Rotation\ point\"\n\ foreach\ \{a1\ a2\ a3\}\ \{nw\ n\ ne\ w\ c\ e\ sw\ s\ se\}\ \{\n\ \ \ \ radiobutton\ .l.\$a1\ -text\ \$a1\ -variable\ anchor\ -value\ \$a1\ -anchor\ w\ -command\ DrawAnchor\n\ \ \ \ radiobutton\ .l.\$a2\ -text\ \$a2\ -variable\ anchor\ -value\ \$a2\ -anchor\ w\ -command\ DrawAnchor\n\ \ \ \ radiobutton\ .l.\$a3\ -text\ \$a3\ -variable\ anchor\ -value\ \$a3\ -anchor\ w\ -command\ DrawAnchor\n\ \ \ \ grid\ .l.\$a1\ .l.\$a2\ .l.\$a3\ -sticky\ ew\n\ \}\n\ button\ .rotate\ -text\ Rotate\ -command\ Doit\n\ button\ .reset\ -text\ Reset\ -command\ Reset\n\ image\ create\ photo\ ::img::blank\ -width\ 1\ -height\ 1\n\ button\ .about\ -image\ ::img::blank\ -highlightthickness\ 0\ -command\ \\\n\ \ \ \ \{tk_messageBox\ -message\ \"Canvas\ Rotation\\nby\ Keith\ Vetter,\ March\ 2003\"\}\n\ place\ .about\ -in\ .\ -relx\ 1\ -rely\ 1\ -anchor\ se\n\ \n\ grid\ .c\ -\ -\ -\ -row\ 0\ -sticky\ news\n\ grid\ .l\ .angle\ .rotate\n\ grid\ ^\ \ ^\ \ \ \ \ \ .reset\n\ grid\ rowconfigure\ .\ 0\ -weight\ 1\n\ grid\ columnconfigure\ .\ 3\ -weight\ 1\n\ grid\ config\ .angle\ -sticky\ n\ -pady\ 7\n\ \n\ set\ anchor\ c\n\ set\ angle\ 30\n\ Reset\n\n----\nFor\ use\ with\ animations,\ speed\ is\ an\ issue.\ Especially\ for\ use\ in\ mobile\ systems\ without\ floating\ point\ processor.\nFor\ this\ purpose,\ goniometrics\ could\ be\ replaced\ by\ look-ups\ with\ 5\ entries\ (1-5\ degrees,\ beyond\ 5\ with\ gonio).\nHowever,\ the\ simple\ improvement\ below\ may\ be\ sufficient\ and\ halves\ execution\ time\ (measured\ with\ ARM9\ system,\ w/o\ FPU)\ -\ \[RJM\].\n\ #\ First\ improvement\ step:\ goniometrics\ out\ of\ loop\n\ proc\ object_rotate\ \{w\ tag\ Ox\ Oy\ angle\}\ \{\n\ \ \ \ #foreach\ \{Ox\ Oy\}\ \[object_center\ \$w\ \$tag\]\ break\n\ \ \ \ set\ angle\ \[expr\ \{\$angle\ *\ atan(1)\ /\ 45.0\}\]\ \;#\ Radians\n\ \ \ \ set\ sin\ \[expr\ \{sin(\$angle)\}\]\n\ \ \ \ set\ cos\ \[expr\ \{cos(\$angle)\}\]\n\ \ \ \ foreach\ id\ \[\$w\ find\ withtag\ \$tag\]\ \{\ \ \ \ \ \;#\ Do\ each\ component\ separately\n\ \ \ \ \ \ \ \ set\ xy\ \{\}\n\ \ \ \ \ \ \ \ foreach\ \{x\ y\}\ \[\$w\ coords\ \$id\]\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ #\ rotates\ vector\ (Ox,Oy)->(x,y)\ by\ angle\ clockwise\n\ \ \ \ \ \ \ \ \ \ \ \ set\ x\ \[expr\ \{\$x\ -\ \$Ox\}\]\ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Shift\ to\ origin\n\ \ \ \ \ \ \ \ \ \ \ \ set\ y\ \[expr\ \{\$y\ -\ \$Oy\}\]\n\ \ \ \ \ \ \ \ \ \ \ \ set\ xx\ \[expr\ \{\$x\ *\ \$cos\ -\ \$y\ *\ \$sin\ +\ \$Ox\}\]\ \;#\ Rotate\ and\ shift\ back\n\ \ \ \ \ \ \ \ \ \ \ \ set\ yy\ \[expr\ \{\$x\ *\ \$sin\ +\ \$y\ *\ \$cos\ +\ \$Oy\}\]\n\ \ \ \ \ \ \ \ \ \ \ \ lappend\ xy\ \$xx\ \$yy\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \$w\ coords\ \$id\ \$xy\n\ \ \ \ \}\n\ \}\n\n----\n\n\n\n\n\n\n======\n----\n\n***Screenshots***\n\n\n\n\n\n\n\n\[http://farm5.static.flickr.com/4033/4690372933_cab9267ef2.jpg\]\n\n\n\n\n\n\n\n\ \ \ \ \ \ \ \n\n\n\[gold\]\ added\ pix\ \n\n----\n\n\n\n\n\n\n\n\n\n----\n!!!!!!\n%|\ \[Category\ Graphics\]\ |%\n!!!!!!} CALL {my revision {Canvas Rotation}} CALL {::oo::Obj6771546 process revision/Canvas+Rotation} CALL {::oo::Obj6771544 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4