Re: Finding End Points for a skewed/rotated Ellipse drawn with GraphicsPath
From: Kyle West (kwest2123_at_yahoo.com)
Date: 04/06/04
- Next message: Bob: "Re: Drawing GURU Help - Icon & Filestream Help .NET"
- Previous message: Bob Powell [MVP]: "Re: Handling 16bit grayscale images"
- In reply to: Kyle West: "Finding End Points for a skewed/rotated Ellipse drawn with GraphicsPath"
- Messages sorted by: [ date ] [ thread ]
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!
- Next message: Bob: "Re: Drawing GURU Help - Icon & Filestream Help .NET"
- Previous message: Bob Powell [MVP]: "Re: Handling 16bit grayscale images"
- In reply to: Kyle West: "Finding End Points for a skewed/rotated Ellipse drawn with GraphicsPath"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|