Hi all,(adsbygoogle = window.adsbygoogle || []).push({});

I'm currently writing an iPhone application where I'm taking the following ellipse which I created in Adobe Illustrator:

http://img29.imageshack.us/img29/6584/95436658.gif [Broken]

And drawing it in my code using the following:

CGPathMoveToPoint(515.98, 258.24);

CGPathAddCurveToPoint(515.98, 435.61, 415.54, 515.98, 258.24, 515.98);

CGPathAddCurveToPoint(100.94, 515.98, 0.50, 435.61, 0.50, 258.24);

CGPathAddCurveToPoint(0.50, 80.86, 100.94, 0.50, 258.24, 0.50);

CGPathAddCurveToPoint(415.54, 0.50, 515.98, 80.86, 515.98, 258.24);

Where CGPathAddCurveToPoint draws a cubic bezier curve to a graphics path. The first four parameters for this function are the first and second control points respectively, and the last two parameters are the end point ie CGPathAddCurveToPoint(cp1x, cp1y, cp2x, cp2y, epx, epy). Each call to CGPathAddCurveToPoint draws one of the four curves that make up my ellipse. Also, CGPathMoveToPoint sets the starting point.

As you can see from above, the code draws the ellipse within a 515.98 x 515.98 square. What I'm trying to do is, I want my code to fit this ellipse (and stretch it) within any rectangular shape I give it. So I'll need to express the points I have up top in terms of the rectangular width and height of the given rectangle. This is easy enough to do for the end points. I am having trouble however figuring out how to express the control points in this manner. Would this be some proportion of the height or width? Any help would be appreciated.

**Physics Forums - The Fusion of Science and Community**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# How to Stretch an Elipse Made of Bezier Paths

Loading...

Similar Threads - Stretch Elipse Made | Date |
---|---|

What's it called when a 3D shape can be made of 2D surfaces of all the same size | Apr 9, 2012 |

Length of a line segment that binds the center of an ellipse with point of the elipse | Jan 19, 2012 |

Find the center of the curve in 3D made by 4-points | Nov 6, 2008 |

Finding new major axis of ellipse after stretching along arbitrary axis | Sep 8, 2008 |

Riemann roch made easy | Aug 14, 2005 |

**Physics Forums - The Fusion of Science and Community**