void Poly::drawLineNumbers() const { Vector3d v,v2; for (uint i=0;i < vertices.size();i++){ v = getVertexCircular3(i); v2 = getVertexCircular3(i+1); ostringstream oss; oss << i; Render::draw_string((v+v2)/2., oss.str()); } }
void Poly::getLines(vector<Vector3d> &lines, uint startindex) const { size_t count = vertices.size(); if (count<2) return; // one point no line if (count<3) count--; // two points one line for(size_t i=0;i<count;i++) { lines.push_back(getVertexCircular3(i+startindex)); lines.push_back(getVertexCircular3(i+startindex+1)); } }
void Poly::drawLineNumbers() const { Vector3d v,v2; for (uint i=0;i < vertices.size();i++){ v = getVertexCircular3(i); v2 = getVertexCircular3(i+1); ostringstream oss; oss << i; renderBitmapString((v+v2)/2., GLUT_BITMAP_8_BY_13 , oss.str()); } }
// add to lines starting with given index // closed lines sequence void Poly::getLines(vector<printline> &plines, uint startindex) const { size_t count = vertices.size(); if (count<2) return; // one point no line if (count<3) count--; // two points one line for(size_t i=0;i<count;i++) { struct printline pline; pline.from = getVertexCircular3(i+startindex); pline.to = getVertexCircular3(i+startindex+1); pline.extrusionfactor = extrusionfactor ; plines.push_back(pline); } }
void Poly::transform(const Matrix4d &T) { for (uint i = 0; i < vertices.size(); i++) { const Vector3d v = T * getVertexCircular3(i) ; vertices[i].set(v.x(),v.y()); } setZ((T * Vector3d(0,0,z)).z()); calcHole(); }
void Poly::makeLines(vector<Vector3d> &lines, uint startindex) const { vector<Vector3d> mylines; size_t count = vertices.size(); if (count<2) return; // one point no line bool closedlines = closed; if (count<3) closedlines = false; // two points one line for(size_t i = startindex; i < count+startindex; i++) { if (!closedlines && i == count-1) continue; lines.push_back(getVertexCircular3(i)); lines.push_back(getVertexCircular3(i+1)); } if (!closedlines && startindex == count-1) lines.insert(lines.end(),mylines.rbegin(),mylines.rend()); else lines.insert(lines.end(),mylines.begin(),mylines.end()); }
void Poly::drawVertexNumbers() const { Vector3d v; for (uint i=0;i < vertices.size();i++){ v = getVertexCircular3(i); glVertex3f(v.x(),v.y(),v.z()); ostringstream oss; oss << i; Render::draw_string(v, oss.str()); } }
void Poly::drawVertexNumbers() const { Vector3d v; for (uint i=0;i < vertices.size();i++){ v = getVertexCircular3(i); glVertex3f(v.x,v.y,v.z); ostringstream oss; oss << i; renderBitmapString(v, GLUT_BITMAP_8_BY_13 , oss.str()); } }
void Poly::drawVertexAngles() const { Vector3d v; for (uint i=0;i < vertices.size();i++){ v = getVertexCircular3(i); glVertex3f(v.x(),v.y(),v.z()); double angle = angleAtVertex(i); ostringstream oss; oss << (int)(angle*180/M_PI); Render::draw_string(v, oss.str()); } }
void Poly::draw(int gl_type, bool reverse) const { Vector3d v;//,vn,m,dir; uint count = vertices.size(); glBegin(gl_type); for (uint i=0;i < count;i++){ if (reverse){ v = getVertexCircular3(-i); // vn = getVertexCircular3(-i-1); } else { v = getVertexCircular3(i); // vn = getVertexCircular3(i+1); } glVertex3f(v.x,v.y,v.z); // if (gl_type==GL_LINE_LOOP){ // m = (v+vn)/2; // dir = m + rotatedZ((vn-v)/10,M_PI/2); // glVertex3f(dir.x,dir.y,z); // } } glEnd(); }