T
Talon
Hi all,
I am new to Tk, so please bear with me. I need someone better at math
than me to help me figure this out. I am drawing multiple arcs on the
same circle. All arcs start at 90 and have varying negative extents
(different colors, goes all the way around. Represents a microbial
genome). So now that my arcs are drawn, I would would like to draw a
line, 25 pixels long that starts on the circle at the endpoint of each
of the arcs, and looks like an extension of the radius extending above
the circle. Then I would like to print text at the end of this line. So
my question is how do I dynamically calculate the line coordinates?
Circle size is fixed, number of arcs and their extents are variable.
Code for drawing arc;
$x1,$y1 = 25
$x2,$y2 = 775
$xcenter = $x2/2 + $x1;
$ycenter = $y2/2 + $y1;
$canvas->createArc($x1,$y1,$x2,$y2,
-width=>10,
-outline=>$colors[$color],
-style=>'arc',
-start=>90,
-extent=>-$actual_angle,
-tags=>$myorfs{$key}[1]);
What I have so far to draw lines:
$xstart = (cos($current_arclength)*$radius+$xcenter) /10;
$ystart = (sin($current_arclength)*$radius+$ycenter) /10;
$canvas->createLine($xstart+$xcenter,
$ystart+$ycenter,
$xstart+($xstart*0.01)+$xcenter,
$ystart+($ystart*0.01)+$ycenter);
This draws an oval of lines, inside the orginal circle, with the line
length having sin periodicity around the circle. Can anyone improve my
math so that I can get the lines placed properly with the proper length?
Please email me directly as well as respond to the list. Thanks so much
in advance.
--Math Challenged Mark
(e-mail address removed)
I am new to Tk, so please bear with me. I need someone better at math
than me to help me figure this out. I am drawing multiple arcs on the
same circle. All arcs start at 90 and have varying negative extents
(different colors, goes all the way around. Represents a microbial
genome). So now that my arcs are drawn, I would would like to draw a
line, 25 pixels long that starts on the circle at the endpoint of each
of the arcs, and looks like an extension of the radius extending above
the circle. Then I would like to print text at the end of this line. So
my question is how do I dynamically calculate the line coordinates?
Circle size is fixed, number of arcs and their extents are variable.
Code for drawing arc;
$x1,$y1 = 25
$x2,$y2 = 775
$xcenter = $x2/2 + $x1;
$ycenter = $y2/2 + $y1;
$canvas->createArc($x1,$y1,$x2,$y2,
-width=>10,
-outline=>$colors[$color],
-style=>'arc',
-start=>90,
-extent=>-$actual_angle,
-tags=>$myorfs{$key}[1]);
What I have so far to draw lines:
$xstart = (cos($current_arclength)*$radius+$xcenter) /10;
$ystart = (sin($current_arclength)*$radius+$ycenter) /10;
$canvas->createLine($xstart+$xcenter,
$ystart+$ycenter,
$xstart+($xstart*0.01)+$xcenter,
$ystart+($ystart*0.01)+$ycenter);
This draws an oval of lines, inside the orginal circle, with the line
length having sin periodicity around the circle. Can anyone improve my
math so that I can get the lines placed properly with the proper length?
Please email me directly as well as respond to the list. Thanks so much
in advance.
--Math Challenged Mark
(e-mail address removed)