Re: Finding End Points for a skewed/rotated Ellipse drawn with GraphicsPath

From: Kyle West (kwest2123_at_yahoo.com)
Date: 04/06/04


Date: Mon, 05 Apr 2004 18:13:50 -0700

Yes, I have tried just transforming the points, but that doesn't work.
See, when I call AddEllipse with a standard rectangle, the left and
right endpoints happen to fall in the middle of the the rectangle on the
Y-axis, and at the left and right edges of the rectangle on the X-axis.
But when I apply the transform, the same points don't represent those
edges anymore. In fact, if I read the points out of the GraphicsPath,
and plot them, they aren't even on the edge of the ellipse anymore, they
are outside of it. The graphicsPath contains 13 points, and it applies
whatever formula to determine how the ellipse will look. The ellipse
doesn't run parellel to the x-axis anymore, it goes at more of a
diagonal. I'm sure there is a formula to calculate it out, but I
haven't had any luck finding out what it is, and I don't know what the
GraphicsPath uses to go from the 13 points to a smooth ellipse. If I
knew the formula, I could use it to calculate the end points I guess.
I'm sorry, I'm probably doing a bad job of explaining it. But if you try
something like this:

RectangleF r = new RectangleF(0,0,500,500);
Matrix m = new Matrix();
m.Translate(100,0);
m.Shear(-1, 0);
GraphicsPath gp = new GraphicsPath();
gp.AddEllipse(r);
gp.Transform(m);

And then comment out the transform, you can see the difference. Even
though the shear only moves the X coordinate, and not the Y-coordinate
for the rectangle, both the X and the Y coordinates move for the edges
of the ellipse. I think it's because the GraphicsPath is trying to fit
the biggest ellipse it can into the rectangle, and because of the
skewing, the ellipse will be bigger if the x-axis runs diagonal instead
of straight across.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: Finding End Points for a skewed/rotated Ellipse drawn with GraphicsPath
    ... has a TransformPoints method that will transform an array of points. ... The ellipse is being drawn with a shear ... > in the GraphicsPath that used to represent the left endpoint of the ... > I need some way to find out what the left and right endpoints of the ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: what is the analytical function for this 2D shape?
    ... >The bottom of this function should look like a ellipse. ... >That's to say, the contour of fat the height z=0 is ... >with the aspect ratio for the rectangle at the top. ... Let's do a slightly more general problem because it makes it ...
    (sci.math)
  • Re: looking for a separable 2D function to have a strange shape!
    ... >that height is like a rectangle. ... >The bottom of this function should look like a ellipse. ... >ratio for the rectangle at the top. ...
    (sci.math.num-analysis)
  • Re: looking for a separable 2D function to have a strange shape!
    ... >that height is like a rectangle. ... >The bottom of this function should look like a ellipse. ... >ratio for the rectangle at the top. ...
    (sci.math)
  • Re: A question about OnDraw
    ... If I do in this way an Ellipse is drawn which happen to be a circle according to my definition of m_rectEllipse above. ... void CEx04aView::OnDraw(CDC* pDC) ... Retrieves the dimensions of the tightest bounding rectangle around the current clipping boundary. ...
    (microsoft.public.vc.mfc)

Quantcast