Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Was wondering if there was a function for blending ellipses when they make contact with each other. I was thinking about a GraphicsPath object since it adds objects to it's path. If there is a term for this I do not know what it would be so searching has not revealed anything thus far. Thanks for some guidance.

Example
Posted
Updated 11-Dec-14 12:14pm

1 solution

You are on the right path with graphicspath.
You create 2 graphics paths and add the ellipses defined by a rectangle.
Create 2 regions based on the path constructors
calling r.Intersect will transform r into the region you are looking for
conversely, calling r2.Intersect will transform r2 into the region you are looking for

VB
Dim path1 As New Drawing2D.GraphicsPath()
path1.AddEllipse(New Rectangle(0, 0, 10, 20))
Dim path2 As New Drawing2D.GraphicsPath()
path2.AddEllipse(New Rectangle(0, 0, 10, 20))
Dim r As New Region(path1)
Dim r2 As New Region(path2)
r.Intersect(path2)
 
Share this answer
 
Comments
Idle_Force 11-Dec-14 18:13pm    
Thanks for your help. r.Union is the closest I can get to being right. I was wanting the sides where they meet to ease larger to the diameter. The Example link shows what I am after. I was hoping not to have to re-invent the wheel here, but it looks like I may have to do some adding of Arcs that attach at some point based on the Trigonometry of where they meet and a straight line for both sides and calculate the angle based on the overlap.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900