Drawing a circle of vertices in ofMesh

Hi everyone,

I am trying to add a circle of vertices to ofMesh. I have no idea why I am having such a hard time hahah. I want to draw the vertices with ofVec3f as I will draw more circles on zindex once I get this circle drawn. I suspect I am doing some super noob mistake… any help appreciated!

int radius = 40;
int circlepts = 40;

ofPoint startpt;
ofPoint circx, circy, circz;

void ofApp::setup(){
    
    mesh.setMode(OF_PRIMITIVE_POINTS);

//add center
    startpt = ofVec3f(0,0,0);
    mesh.addVertex(startpt);

//draw first circle of vertices
    for(int i = 0; i < circlepts; i++){
        
        float angle = i * TWO_PI / circlepts;
        
        cout << angle << endl;
        
        circx = startpt + radius * cos(angle);
        circy = startpt + radius * sin(angle);
        circz = startpt;
        
        ofVec3f p = (circx, circy, circz);
        
        mesh.addVertex(p);
        
    }
    
}

Check the type of circx, circy, circz and startpt.

1 Like