Commit 05225f41 authored by Stéphane  DALLONGEVILLE's avatar Stéphane DALLONGEVILLE
Browse files

Force stay into bounds field otherwise we can get infinite derivation which are really annoying..

parent 29af64ba
......@@ -1128,7 +1128,7 @@ public class Polygon2D extends ActiveContour
// FIXME: it appears to be better to always apply model force but just reducing it (Stephane)
if ((boundField == null) || boundField.contains(p.x, p.y, 0, 0, 0))
{
if (modelForces[index] != null)
if ((modelForces[index] != null) && (nearBounds != null))
{
// close from border of "bound field" ? --> reduce model forces
if ((p.x < nearBounds.getMinX()) || (p.x > nearBounds.getMaxX()))
......@@ -1139,11 +1139,16 @@ public class Polygon2D extends ActiveContour
}
else
{
// reduce model force
// inhibit model force
if (modelForces[index] != null)
modelForces[index].scale(0.1);
// reduce feedback force
feedbackForces[index].scale(0.25);
modelForces[index].scale(0);
// inhibit feedback force
feedbackForces[index].scale(0);
// // reduce model force
// if (modelForces[index] != null)
// modelForces[index].scale(0.1);
// // reduce feedback force
// feedbackForces[index].scale(0.25);
}
// set initial model force
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment