Skip to main content
gamedev.net
🔒 Locked

inverted arc?

Started by coda_x 2 replies 300+ views
Original Post
coda_x
coda_x
the following code will draw a polygon with 3 square corners and 1 rounded corner. But my original intention is draw the arc in the rounded corner in the inverted way such that it is "chipped" off instead of rounded.How do i modify? int SUBDIVS=10; glBegin(GL_POLYGON); glNormal3f( 0.0f, 0.0f, -1.0f); glVertex3f(-x+d, d, 1.0f); glVertex3f(-x+d,-y-d, 1.0f); glVertex3f(d,-y-d, 1.0f); glVertex3f(d,0,1.0f); float arcx; float arcy; for (i=0;i<= SUBDIVS; i++) { arcx = d*cos(i*(pi/2)/SUBDIVS); arcy = d*sin(i*(pi/2)/SUBDIVS); glVertex3f(arcx,arcy,1.0f); } glEnd();
orbano
orbano
it is simple too. but the center of the arc is the 4th point of the rectangle (of coure you have to set the correct quarter of the 2*PI cicle of the full circle)
"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin
coda_x
coda_x
i modify my code as shown but still not getting what I want. Can someone show me the correct code? thank you

int SUBDIVS=10;


glBegin(GL_POLYGON);
glNormal3f( 0.0f, 0.0f, -1.0f);
glVertex3f(-x+d, d, 1.0f);
glVertex3f(-x+d,-y-d, 1.0f);
glVertex3f(d,-y-d, 1.0f);
glVertex3f(d,0,1.0f);
float arcx;
float arcy;
glTranslatef(d,d,0.0f);
for (i=10;i>= 0; i--) {
arcx = d*cos(i*(-pi/2)/SUBDIVS);
arcy = d*sin(i*(-pi/2)/SUBDIVS);
glVertex3f(-arcx,arcy,1.0f);
}
glEnd();

[edited by - coda_x on January 11, 2004 8:06:29 PM]
coda_x
coda_x
I know where is the problem. I did nt translate the axis properly. now it works fine.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.