Skip to content

Commit

Permalink
Added AddEdge to the MeshSampler functor to enable the correct sampli…
Browse files Browse the repository at this point in the history
…ng of an edgemesh
  • Loading branch information
cignoni committed May 13, 2024
1 parent 913d448 commit 1016837
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion vcg/complex/algorithms/point_sampling.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ class MeshSampler
public:
typedef typename MeshType::VertexType VertexType;
typedef typename MeshType::FaceType FaceType;
typedef typename MeshType::EdgeType EdgeType;
typedef typename MeshType::CoordType CoordType;
typedef typename MeshType::ScalarType ScalarType;

MeshSampler(MeshType &_m):m(_m){
perFaceNormal = false;
Expand All @@ -197,7 +199,14 @@ class MeshSampler
tri::Allocator<MeshType>::AddVertices(m,1);
m.vert.back().ImportData(p);
}


void AddEdge(const EdgeType& e, ScalarType u ) // u==0 -> v(0) u==1 -> v(1);
{
tri::Allocator<MeshType>::AddVertices(m,1);
m.vert.back().P() = e.cV(0)->cP()*(1.0-u)+e.cV(1)->cP()*u;
m.vert.back().N() = e.cV(0)->cN()*(1.0-u)+e.cV(1)->cN()*u;
}

void AddFace(const FaceType &f, CoordType p)
{
tri::Allocator<MeshType>::AddVertices(m,1);
Expand Down

0 comments on commit 1016837

Please sign in to comment.