[英]Add edges to Openmesh mesh
剛開始使用OpenMesh,到目前為止我已經能夠添加頂點和構圖。 我現在有一個問題,了解我應該如何添加邊網格。
我知道openMesh使用的半邊數據結構,但我不能真正理解我應該如何添加邊緣..
碼:
定義:
Variables in header:
vector<OpenMesh::PolyMesh_ArrayKernelT<OpenMeshExt::MyOwnTraits>::VertexHandle> vHandlers;
OpenMesh::PolyMesh_ArrayKernelT<OpenMeshExt::MyOwnTraits> myMesh;
在cpp中:
typedef OpenMesh::PolyMesh_ArrayKernelT<OpenMeshExt::CustomTraits> OpnMesh;
typedef OpnMesh::VertexHandle vertexHandle;
void Mesh::addVertexFromPoint(Point& position){
float x = static_cast <float> (position.x());
float y = static_cast <float> (position.y());
vertexHandle vhand= myMesh.add_vertex(OpnMesh::Point(x,y,.0f));
vHandlers.push_back(vhand);
}
void Mesh::makeFace(){
if(vHandlers.size()<=2){
return;
}
myMesh.add_face(vHandlers);
//Add edges between eg vertex 0 and 1 in vHandlers (vector with VertexHandlers)
}
搜索了文檔,但不能說我找到了答案..
您不必/您無法顯式創建或刪除邊。 每當您修改網格時,例如通過使用add_face
創建面,網格將創建(或刪除)必要的(半)邊。 此外,它將調整頂點,邊和面之間的鏈接以反映網格的拓撲。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.