Trim ellipse
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Trim ellipse

  1. #1
    Join Date
    Sep 2008
    Posts
    63

    Trim ellipse

    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.

  2. #2
    Join Date
    Jun 2001
    Location
    Melbourne/Aus (C# .Net 4.0)
    Posts
    686

    Re: Trim ellipse

    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.
    Rob
    -
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center