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)
}
ドキュメントを検索しましたが、答えが見つかったとは言えません..