• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

Geometry question? corners of a circle.

I bet this is one of those "oh man that was simple" things.. I have a RECT which I use to draw an ellipse (not necessarilly circle). my ellipse gets drag handles on the north/east/south/west edges and I determine those simply with the mid position of the sides of the RECT.

How can I calculate the x/y coordinates of the "corners of the circle" - that is, the NE, SE, SW and NW points along the circumference?   Conceptually, if I could take that same RECT and rotate it 45deg I could then simply take the center points again, and that would give me the corners along the circumference.

but how do I rotate a rect?
  • 4
  • 3
1 Solution
Harisha M GCommented:
Hi PMH4514,
    Do you want only the co-ordinates of the points ??
    Then it is easy...
    sqrt(2) * radius


Harisha M GCommented:


    0.707 * radius
PMH4514Author Commented:
the ellipse is not necessarilly a circle, I don't know the radius.

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

PMH4514Author Commented:
picture a vector drawing program - you draw a circle and it has 4 handles for dragging at North, East, South, West.

Now imagine there were 4 more handles, at Northeast, Southeast, Southwest and Northwest.

as the circle is dragged into an oblong ellipse in any direction, I need to calculate the x/y location at which to draw the northeast, southeast, southwest and northwest handles. The only coordinates I do know are that of the RECT that I passed to CDC::Ellipse() to draw the ellipse.
Harisha M GCommented:
x co-ord = width * 0.707
y co-ord = height * 0.707
Harisha M GCommented:
Note that the co-ordinates specified are from centre...
        |                   |     ^
        |                   |      y
        |                   |     V
        <-----  x  ----->


x/2, y/2 will be the centre of the elliplse

x/2 + x/2 * 0.707, y/2 + y/2 * 0.707 will be the NE corner
x/2 - x/2 * 0.707, y/2 + y/2 * 0.707 will be the NW corner
x/2 + x/2 * 0.707, y/2 - y/2 * 0.707 will be the SE corner
x/2 - x/2 * 0.707, y/2 - y/2 * 0.707 will be the SW corner

PMH4514Author Commented:
oooh.. I see what you're doing..  I think that will work just fine.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now