Skip to content

Instantly share code, notes, and snippets.

@robbielynch
Created October 23, 2013 09:57
Show Gist options
  • Save robbielynch/7115778 to your computer and use it in GitHub Desktop.
Save robbielynch/7115778 to your computer and use it in GitHub Desktop.
C++ Code to draw an isosagon using the SFML library.
int points = 20;
double totRads = 2 * 3.14159;
double angle = totRads / points;
int r = 200;
int pointNum = 1;
int originY = 300;
int originX = 300;
glBegin(GL_LINE_LOOP);
for(int i = 1; i <= points; i++){
int x = r*cos(angle * pointNum) + originX;
int y = r*sin(angle * pointNum) + originY;
glColor3d(200,0,0);
glVertex2d(x, y);
pointNum++;
}
glEnd();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment