Click to See Complete Forum and Search --> : Trim ellipse


hotsaravana
November 3rd, 2009, 10:36 PM
Hi,
I want to trim/remove portion of the ellipse when it intersect with another ellipse.There is no inbuilt function in C# to find intersection points.

So I tried by solving both ellipse equation...but i couldnt solve the equation completely since it is resulting in 4 degree equation.

Can any one suggest how to proceed.

rliq
November 5th, 2009, 05:44 PM
A suggestion, but needs a little work. Assuming you have used an equation to calculate all of the points in your foreground ellipse and they are in pt[] and you are drawing in response to a Paint message and hence have the Graphics g.

Draw the foreground ellipse.

Create a GraphicsPath gp, using the points in pt[].

Create a Region r passing gp in the constructor.

Do a g.ExcludeClip(r) to prevent painting in the Region r.

Draw the background ellipse.

I got it to work using the bounding Rectangle of the foreground ellipse to create the Region, but that is not exactly what you want.

Hope this helps.