### Author Topic: Drawing an Ellipse  (Read 14335 times)

0 Members and 1 Guest are viewing this topic.

#### Mr. X

• Jr. Member
• Posts: 80
##### Drawing an Ellipse
« on: October 18, 2008, 07:04:31 pm »
Hello,
Is it possible to Add a method to the sf::Shape class for drawing an ellipse, or change the circle function, so that it could draw ellipses?

#### bullno1

• Jr. Member
• Posts: 66
##### Drawing an Ellipse
« Reply #1 on: October 19, 2008, 07:27:21 am »
Isn't an ellipse just a scaled circle?

#### Mr. X

• Jr. Member
• Posts: 80
##### Drawing an Ellipse
« Reply #2 on: October 19, 2008, 10:47:09 am »
Yes,
but if I try to scale it, it is just moved by that factor...

#### gsaurus

• Sr. Member
• Posts: 262
##### Drawing an Ellipse
« Reply #3 on: October 25, 2008, 07:02:31 pm »
Quote from: "Mr. X"
Yes,
but if I try to scale it, it is just moved by that factor...

Use setCenter to center in the circle center before scale
Pluma - Plug-in Management Framework

#### Mr. X

• Jr. Member
• Posts: 80
##### Drawing an Ellipse
« Reply #4 on: October 26, 2008, 09:54:03 am »
Hello,
it doesn't work. Also when I center the circle before scaling, it is only moved by this factor.

#### Noegddgeon

• Jr. Member
• Posts: 53
##### Drawing an Ellipse
« Reply #5 on: December 21, 2010, 09:51:45 am »
When setting the center of the circle, it's relative to the top left coordinates of the circle, not the whole window. I was trying to figure this out and made the mistake of assuming otherwise, but I was able to figure out, in case anyone else looks at this thread in the future and wonders the same thing.

Code: [Select]
`sf::Shape myEllipse = sf::Shape::Circle(200, 200, 60, sf::Color(255, 0, 0));myEllipse.SetCenter(30, 30);myEllipse.SetScale(2, 1);`

Instead of writing the SetCenter function like...
Code: [Select]
`myEllipse.SetCenter(230, 230);`

Solves the problem for me when scaling the circle.
Whether you think you can or you can't, you're right.

anything