/** @def This funcion calculate the cartesian coordinates of a point given from its barycentric coordinates @param Point3f bc - barycentric coordinates of the point @param FacePointer f - pointer to the face @return cartesian coordinates of the point */ CMeshO::CoordType fromBarCoords(Point3f bc,CMeshO::FacePointer f){ CMeshO::CoordType p; Point3f p0=f->P(0); Point3f p1=f->P(1); Point3f p2=f->P(2); p=f->P(0)*bc[0]+f->P(1)*bc[1]+f->P(2)*bc[2]; return p; }
// // Draws a triangle // void edit_topo::drawFace(CMeshO::FacePointer fp) { glPointSize(3.0f); glBegin(GL_POINTS); //GL_LINE_LOOP); glVertex(fp->P(0)); glVertex(fp->P(1)); glVertex(fp->P(2)); glEnd(); }
void LandmarkCapturePlugin::drawFace(CMeshO::FacePointer fp, MeshModel &m, GLArea *gla, QPainter *p) { //glDepthMask(GL_FALSE); //glDisable(GL_DEPTH_TEST); //p->endNativePainting(); //p->save(); //p->setRenderHint(QPainter::TextAntialiasing); //p->setPen(Qt::white); //QFont qFont; //qFont.setStyleStrategy(QFont::NoAntialias); //qFont.setFamily("Helvetica"); //qFont.setPixelSize(12); //p->setFont(qFont); QString buf = QString("f%1\n (%3 %4 %5)").arg(tri::Index(m.cm,fp)).arg(tri::Index(m.cm,fp->V(0))).arg(tri::Index(m.cm,fp->V(1))).arg(tri::Index(m.cm,fp->V(2))); Point3f c=Barycenter(*fp); vcg::glLabel::render(p,c,buf); for(int i=0;i<3;++i) { buf =QString("\nv%1:%2 (%3 %4 %5)").arg(i).arg(fp->V(i) - &m.cm.vert[0]).arg(fp->P(i)[0]).arg(fp->P(i)[1]).arg(fp->P(i)[2]); if( m.hasDataMask(MeshModel::MM_VERTQUALITY) ) buf +=QString(" - Q(%1)").arg(fp->V(i)->Q()); if( m.hasDataMask(MeshModel::MM_WEDGTEXCOORD) ) buf +=QString("- uv(%1 %2) id:%3").arg(fp->WT(i).U()).arg(fp->WT(i).V()).arg(fp->WT(i).N()); if( m.hasDataMask(MeshModel::MM_VERTTEXCOORD) ) buf +=QString("- uv(%1 %2) id:%3").arg(fp->V(i)->T().U()).arg(fp->V(i)->T().V()).arg(fp->V(i)->T().N()); vcg::glLabel::render(p,fp->V(i)->P(),buf); } //p->drawText(QRect(0,0,gla->width(),gla->height()), Qt::AlignLeft | Qt::TextWordWrap, buf); //p->restore(); //p->beginNativePainting(); }