Skip to content

Instantly share code, notes, and snippets.

@unohee
Created July 1, 2016 01:04
Show Gist options
  • Save unohee/bf3f0a839c625ba6a62e6be01cd2d8d5 to your computer and use it in GitHub Desktop.
Save unohee/bf3f0a839c625ba6a62e6be01cd2d8d5 to your computer and use it in GitHub Desktop.
Best circle drawing in openFrameworks
#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