本文整理汇总了C++中TriangleMesh::vertices方法的典型用法代码示例。如果您正苦于以下问题:C++ TriangleMesh::vertices方法的具体用法?C++ TriangleMesh::vertices怎么用?C++ TriangleMesh::vertices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriangleMesh
的用法示例。
在下文中一共展示了TriangleMesh::vertices方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_obj
void ClickSoundViewer::draw_obj()
{
const vector<Point3d>& vtx = mesh_.vertices();
const vector<Tuple3ui>& tgl = mesh_.surface_indices();
const vector<Vector3d>& nml = mesh_.normals();
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_DOUBLE, 0, (const GLvoid*)(vtx.data()));
glNormalPointer(GL_DOUBLE, 0, (const GLvoid*)(nml.data()));
glDrawElements(GL_TRIANGLES, tgl.size()*3, GL_UNSIGNED_INT, (const GLvoid*)(tgl.data()));
}
示例2: drawWithNames
void ClickSoundViewer::drawWithNames()
{
glEnableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_DOUBLE, 0, (const GLvoid*)(mesh_.vertices().data()));
const vector< Tuple3ui >& tgl = mesh_.triangles();
for(size_t i = 0;i < tgl.size();++ i)
{
glPushName(i);
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, (const GLvoid*)&tgl[i]);
glPopName();
}
}
示例3: draw_triangle_normal
void ClickSoundViewer::draw_triangle_normal()
{
const int tid = selTriId_;
const vector<Point3d>& vtx = mesh_.vertices();
const vector<Tuple3ui>& tgl = mesh_.surface_indices();
const Point3d ctr = (vtx[tgl[tid].x] + vtx[tgl[tid].y] + vtx[tgl[tid].z])*(1./3.);
Vector3d nml = Triangle<double>::weighted_normal( vtx[tgl[tid].x], vtx[tgl[tid].y], vtx[tgl[tid].z] );
double area = nml.normalize2();
const double len = 0.05; ///// HARD coded value here!!!
const Point3d end = ctr + nml * len;
glColor3f(1.f, 0.f, 0.f);
drawArrow( qglviewer::Vec(end.x, end.y, end.z),
qglviewer::Vec(ctr.x, ctr.y, ctr.z),
sqrt(area)*0.8 );
}
示例4: postSelection
void ClickSoundViewer::postSelection(const QPoint&)
{
selTriId_ = selectedName();
//cout << "selected triangle ID: " << selTriId_ << endl;
//// Now synthesize sound and play
{
qglviewer::Vec cam = camera()->position();
const Point3d camPos( cam.x, cam.y, cam.z );
const vector<Point3d>& vtx = mesh_.vertices();
const vector<Tuple3ui>& tgl = mesh_.surface_indices();
Vector3d nml = Triangle<double>::normal(
vtx[tgl[selTriId_].x],
vtx[tgl[selTriId_].y],
vtx[tgl[selTriId_].z] );
nml.normalize();
audio_->play( mesh_.triangle_ids(selTriId_), nml, camPos );
}
if ( selTriId_ >= 0 ) update();
}