in the function used to compute normals for pointclouds, added a check during consensus propagation to avoid flipping normals backface w.r.t. the specified wiewposition.

It does seem redundant, but it may happen, by mere chance, that the starting point used for consensus propagation, forces other points to flip even if the resulting flip places them backface w.r.t. the specified wiewposition
--to be tested--
This commit is contained in:
Marco Callieri 2014-01-10 13:00:09 +00:00
parent c0b621c810
commit 17ed6bdac4
1 changed files with 3 additions and 1 deletions

View File

@ -143,7 +143,9 @@ public:
if(!a.trg->IsV()) if(!a.trg->IsV())
{ {
a.trg->SetV(); a.trg->SetV();
if(a.src->cN()*a.trg->cN()<0) a.trg->N()=-a.trg->N(); if(a.src->cN()*a.trg->cN()<0.0f)
if(!p.useViewPoint || ( a.trg->N().dot(p.viewPoint- a.trg->P())<0.0f)) // test to prevent flipping according to viewpos
a.trg->N()=-a.trg->N();
AddNeighboursToHeap(m,a.trg,tree,heap); AddNeighboursToHeap(m,a.trg,tree,heap);
} }
} }