File: sinusoid.tcl

package info (click to toggle)
xcircuit 3.9.73%2Bdfsg.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,560 kB
  • sloc: ansic: 80,417; sh: 7,295; tcl: 5,891; python: 449; makefile: 300
file content (11 lines) | stat: -rw-r--r-- 333 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
proc sinusoid {a b {c 1.0}} {
   set mylist {}
   for {set t 0} {$t < [expr int(50.0 * $c)]} {incr t} {
      set x [expr int($b * $t / 50.0)]
      set y [expr int($a * sin(2 * 3.1415926 * $t / 50.0))]
      lappend mylist [list $x $y]
   }
   set handle [eval polygon make [llength $mylist] $mylist]
   refresh
   return $handle
}