@Sean_Peart wrote:
Hi, I am in the middle of my project and I am kinda stuck. I am trying to mesh.getvertices()[i].x based on mouse position but I am struggling to work this out. Does anyone have any ideas on how to do this. This this what I have so fat but its leggy and inefficient. I am hoping for a O(1) solution to my problem.
for (int i = 0; i < mesh.getNumVertices(); i++) { if ((mouse.x > mesh.getVertices()[i].x && mouse.x < mesh.getVertices()[i].x + size) && (mouse.y > mesh.getVertices()[i].y && mouse.y < mesh.getVertices()[i].y + size)) { mesh.setColor(i, ofFloatColor(0, 0, 0, 0)); cout << "match" << endl; break; } }
Thanks please help
Posts: 1
Participants: 1