mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-13 21:30:09 +00:00
Merge pull request #2706 from fuchuyuan/extrapolateBarycentricWeights
fix visual and sim mesh matching
This commit is contained in:
commit
823d9c64ab
@ -1589,7 +1589,13 @@ void btSoftBodyHelpers::extrapolateBarycentricWeights(btSoftBody* psb)
|
||||
{
|
||||
new_min_bary_weight = btMin(new_min_bary_weight, bary[k]);
|
||||
}
|
||||
if (new_min_bary_weight > min_bary_weight)
|
||||
|
||||
// p is out of the current best triangle, we found a traingle that's better
|
||||
bool better_than_closest_outisde = (new_min_bary_weight > min_bary_weight && min_bary_weight<0.);
|
||||
// p is inside of the current best triangle, we found a triangle that's better
|
||||
bool better_than_best_inside = (new_min_bary_weight>=0 && min_bary_weight>=0 && btFabs(dist)<btFabs(optimal_dist));
|
||||
|
||||
if (better_than_closest_outisde || better_than_best_inside)
|
||||
{
|
||||
btAlignedObjectArray<const btSoftBody::Node*> parents;
|
||||
parents.push_back(f.m_n[0]);
|
||||
@ -1599,11 +1605,6 @@ void btSoftBodyHelpers::extrapolateBarycentricWeights(btSoftBody* psb)
|
||||
optimal_bary = bary;
|
||||
optimal_dist = dist;
|
||||
min_bary_weight = new_min_bary_weight;
|
||||
// stop searching if the projected p is inside the triangle at hand
|
||||
if (bary[0]>=0. && bary[1]>=0. && bary[2]>=0.)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
psb->m_renderNodesInterpolationWeights[i] = optimal_bary;
|
||||
|
Loading…
Reference in New Issue
Block a user