rotate

rotate x y phi centerX centerY
rotates coords around center by phi

proc rotate {x y phi cX cY} {
  # coords x, y rotated by phi around cX, cY
  set c [cos $phi]
  set s [sin $phi]
  list\
    [expr {($x - $cX) * $c - ($y - $cY) * $s + $cX}]\
    [expr {($y - $cY) * $c + ($x - $cX) * $s + $cY}]
}

© Wolf-Dieter Busch | Home | Sitemap | Urheber | A-Z