Drawing a Graphice Segment

Terence Heaford t.heaford at icloud.com
Sat Jul 25 16:19:01 EDT 2015

> On 25 Jul 2015, at 19:44, J. Landman Gay <jacque at hyperactivesw.com> wrote:
>  Or you might be able to do something fancy by faking a pie slice using a freehand graphic with lots of points along the curved edge, but that's more math than I can do.

I have been giving this a little thought and think it’s achievable through some mathematics.

This is a pie chart and I want to know which segment has been clicked.

I thought the following may work, not implemented yet so any thoughts would be appreciated.


When creating a segment save the start and end angle in the graphic.

The centre of the pie chart is known.

The radius/diameter is known.

Check the mouse click is within the diameter of the pie.

Calculate the angle of the mouse location.

Repeat through the graphics of the pie checking for the graphic where the mouse angle is between the start and end angles.

Now we know the ID of the graphic.


Dose this make sense before I start trying to implement it?

All the best


More information about the Use-livecode mailing list