What I would like to do is build a small window that would look like an
oscilloscope, with a sin wave running. Later an input to be grabbed
externally that would then modify the wave. At the moment I am just
playing around with some circles and rays, so still in a very early
learning process. Took me a bit to realise that every thing is in
radians. This is a little junk of what I have written so far. xf & yf
are my incrementors, cutting the pie so to speak.
set xs [expr $::global(canWidth)/2 ]
set ys [expr $::global(canHeight)/2 ]
set pi 3.141592
set xp [expr 50 * (sin(($xf * $pi) / 180))]
set yp [expr 50 * cos(($yf * $pi) / 180)]
.c creat line $xs $ys [expr (3* $xp) + $xs] [expr $yp +
$ys]\
-width 1 \
-fill green \
-tag "vert"
tks in advance.
> I just started to play with some graphics and trig functions on the
> canvas.
> Anyone out there have some small primers, or a good place to start?
>
> What I would like to do is build a small window that would look like an oscilloscope, with a sin wave running.
Hmm, looks like you want to use the vu widgets perhaps?
They are implemented in C as an extension of the canvas items and offer
you a new stripchart canvas item for an oscilloscope.
Torsten
For plotting functions: the Wiki is a good place to look - you can also
try the BLT extension of Plotchart (in Tklib)
Regards,
Arjen
brace those expressions and you'll get noticibly better performance:
First question, why does bracing the variable change performance?
Second is there another spot that the Don Fellows wavelet might be
found?
I tried http://www.dfw.net/%7Emcody/wavelet.html with no joy.
It has to do with how expr is implemented. You aren't bracing a
variable, you are bracing a whole expression. See here for a tiny bit
more discussion:
If you're _really_ curious, read this (particularly, section 5.2)
http://www.usenix.org/publications/library/proceedings/tcl96/full_papers/lewis/
> Second is there another spot that the Don Fellows wavelet might be
> found?
I don't know.
Try: http://wiki.tcl.tk/8875 for Lissajous Figures
http://wiki.tcl.tk/4206 for Epicycloids and Hypocycloids
Keith
If you're talking about what I think you're talking about, it's part of
the Tk 8.5 demo suite (including the a3 release so you can choose a
distro with it included). Please excuse the very long URL:
http://cvs.sourceforge.net/viewcvs.py/tktoolkit/tk/library/demos/aniwave.tcl?rev=1.2&view=auto
Donal.