How to get mid point of triangle in opegl
i have code of triangle drawing on plane which are follow
glTranslatef(0,0,-6);
glBegin(GL_TRIANGLES);
glVertex3f( 0.2, 0.0, 0.0 );
glVertex3f( 0.0, 0.2, 0.0 );
glVertex3f( 0.0, 0.0, 0.2 );
glEnd();
If i m right triangle is drawing from point (0,0,-6). I want to calculate the middle point and vertices of triangle ( more and less like radius or diameter of circle). Is it right a开发者_开发知识库ngle triangle ?
This has nothing to do with OpenGL (it's simple math).
Lot's of formulas (depending on the kind of "middle point" you're refering to) can be found on Wikipedia.
Using your current coordinates/vertices it's actually an equilateral triangle (all sides have the same length, each angle is 60 ° on the inside).
精彩评论