Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Tomhet

Pages: [1]
1
Graphics / Re: draw ellipses
« on: July 06, 2013, 07:31:03 pm »
//math for ellipse

#include<cmath>



#define PI 3.1415926535898

float radius_x=50;
float radius_y=20;
unsigned short quality=70;

sf::ConvexShape ellipse;
    ellipse.setPointCount(quality);

for(unsigned short i=0;i<quality;++i){
    float rad=(360/quality*i)/(360/PI/2);
    float x=cos(rad)*radius_x;
    float y=sin(rad)*radius_y;

    ellipse.setPoint(i,sf::Vector2f(x,y));
};

ellipse.setPosition(100,100);


Pages: [1]