[mapserver-users] Intersection of rectangle and circle

P Kishor punk.kish at gmail.com
Fri May 9 09:11:23 EDT 2008


Let's clarify a few things first --

On 5/9/08, Sucharita Samuel <iworktech.sucharita at gmail.com> wrote:
> Hi friends,
> I need to find the intersection of a rectangle and circle.

what exactly do you need to find?
  - the points at which they intersect?
  - whether or not they intersect?
  - the overlapping area of their intersection?
  - whether the circle is contained in the rect?
  - whether the rect is contained in the circle?



> As you
>  must be aware that a  circle in mapserver terminology is a shapeobject
> drawn
>  using the upper left and bottom right co-ordinates of a rectangle.

I am now aware of that at all. My MapServer is extremely rusty, but I
remember drawing circles using MapScript and an equation that provided
the center of the circle and the radius. As you can see, there are
more than one ways to do it.


>      In the above case I get the intersection of two rectangles, but as the
>  circle lies inside the rectangle, i am not able to find whether my first
>  rectangle intersects with the bottom corner of the rectangle(that contains
>  the circle), which is not part of the circle.
>

once again, your question is not clear. If a circle 'C' lies inside
rectangle R, then the minimum bounding rectangle (MBR) of the circle
'C' (which is always a square) will lie completely within 'R'.
Depending on your definition of intersection, there may or may not be
any intersection at all.


> I am using ASP.NET. Any solution in this case would be of great help.
>


ASP.NET is irrelevant here. Figure out clearly what you want to
achieve, solve the problem as an algorithm problem, then you can
implement it in any language you want to use.

As is, at least to me, your question is not clear at all.


> Thanks in advance,
> Sucharita
>
>


More information about the mapserver-users mailing list