Created
July 1, 2016 01:04
-
-
Save unohee/bf3f0a839c625ba6a62e6be01cd2d8d5 to your computer and use it in GitHub Desktop.
Best circle drawing in openFrameworks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "ofMain.h" | |
class Circle{ | |
public: | |
ofPath c; | |
ofPath inner; | |
int x,y, lineWidth; | |
float radius; | |
bool fill; | |
ofColor color; | |
Circle():fill(false){ | |
}; | |
//setup | |
void setup(){ | |
//inner circle | |
inner.setCircleResolution(100); | |
inner.circle(x,y, radius-lineWidth); | |
inner.setColor(color); | |
//outer line | |
c.setCircleResolution(100); | |
c.arc(x, y, radius, radius, 0, 360); | |
c.arc(x,y,radius - lineWidth,radius - lineWidth, 0,360); | |
c.setColor(color); | |
}; | |
void draw(){ | |
if(fill){ | |
inner.draw(); | |
} | |
c.draw(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment