Points in a circular area

Dar Scott dsc at swcp.com
Thu Jan 29 13:48:01 EST 2004


On Thursday, January 29, 2004, at 12:36 AM, Alejandro Tejada wrote:

> I'm working with geometric stuff now, and before
> reinvent the wheel, i feel compeled to ask:
>
> Do you have a function that returns all
> the points or coordinates within an arc of
> a circle?

Some years ago I designed a model and library for working with 
abstractions of drawings and paintings in a functional (that is f() 
manner) way.

In that model the plane could be partitioned by a line or by a circle 
and other shapes.  A pie shape is the union (ANDing) of two line 
partitions and a circle partition.

For this particular case, it might be easier for you to arctan2 points 
relative to the center to see if they are in the right angle range and 
then check the distance to see if that is small enough.

In rendering (or creating point lists) I am trying to use interval 
arithmetic and am putting that off until some performance changes in 
Revolution.  This method allows tests to work on whole zones of pixels 
in one calculation.  The line tests will be faster than the arctan2 
tests for this method, because of the ignorance involved in interval 
arithmetic.  Those who have never heard of interval arithmetic can 
safely skip this paragraph.

In the mean time you might try testing each pixel (I assume you mean 
pixels) in the bounding rect of the circle of which the arc is part.

I worry about whether coordinates are between pixels or in the middle, 
but I might be the only one here that does.

Dar Scott




More information about the use-livecode mailing list