Added method BuildFromNonFaux to build an edgemesh composed by the "non faux edges".
This commit is contained in:
parent
9682fcd27d
commit
a9202ed7db
|
@ -655,6 +655,35 @@ void Build( MeshType & in, const V & v)
|
||||||
Build(in,v,dummyfaceVec);
|
Build(in,v,dummyfaceVec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class TriMeshType,class EdgeMeshType >
|
||||||
|
void BuildFromNonFaux(TriMeshType &in, EdgeMeshType &out)
|
||||||
|
{
|
||||||
|
tri::RequireCompactness(in);
|
||||||
|
std::vector<typename tri::UpdateTopology<TriMeshType>::PEdge> edgevec;
|
||||||
|
tri::UpdateTopology<TriMeshType>::FillUniqueEdgeVector(in, edgevec, false);
|
||||||
|
out.Clear();
|
||||||
|
for(size_t i=0;i<in.vert.size();++i)
|
||||||
|
tri::Allocator<EdgeMeshType>::AddVertex(out, in.vert[i].P());
|
||||||
|
tri::UpdateFlags<EdgeMeshType>::VertexClearV(out);
|
||||||
|
|
||||||
|
for(size_t i=0;i<edgevec.size();++i)
|
||||||
|
{
|
||||||
|
int i0 = tri::Index(in,edgevec[i].v[0]);
|
||||||
|
int i1 = tri::Index(in,edgevec[i].v[1]);
|
||||||
|
out.vert[i0].SetV();
|
||||||
|
out.vert[i1].SetV();
|
||||||
|
tri::Allocator<EdgeMeshType>::AddEdge(out,&out.vert[i0],&out.vert[i1]);
|
||||||
|
if(in.vert[i0].IsS()) out.vert[i0].SetS();
|
||||||
|
if(in.vert[i1].IsS()) out.vert[i1].SetS();
|
||||||
|
}
|
||||||
|
|
||||||
|
for(size_t i=0;i<out.vert.size();++i)
|
||||||
|
if(!out.vert[i].IsV()) tri::Allocator<EdgeMeshType>::DeleteVertex(out,out.vert[i]);
|
||||||
|
|
||||||
|
tri::Allocator<EdgeMeshType>::CompactEveryVector(out);
|
||||||
|
}
|
||||||
|
|
||||||
// Build a regular grid mesh as a typical height field mesh
|
// Build a regular grid mesh as a typical height field mesh
|
||||||
// x y are the position on the grid scaled by wl and hl (at the end x is in the range 0..wl and y is in 0..hl)
|
// x y are the position on the grid scaled by wl and hl (at the end x is in the range 0..wl and y is in 0..hl)
|
||||||
// z is taken from the <data> array
|
// z is taken from the <data> array
|
||||||
|
|
Loading…
Reference in New Issue