/** any object associated with a specific point in 3D space */
public abstract class HasQuadric extends HasPoint {
+ public float oldscore = 0;
public Matrix errorQuadric() { return quadric; }
public boolean quadricStale = false;
/** the nearest vertex in the "score_against" mesh */
if (quadricStale || fundamentalQuadric==null)
recomputeFundamentalQuadric();
}
- public abstract void recomputeFundamentalQuadric();
- public abstract void unApplyQuadricToNeighbor();
+ public void recomputeFundamentalQuadric() {
+ unApplyQuadricToNeighbor();
+ if (quadricStale || fundamentalQuadric==null) _recomputeFundamentalQuadric();
+ applyQuadricToNeighbor();
+ }
+ public abstract void _recomputeFundamentalQuadric();
public abstract void applyQuadricToNeighbor();
public abstract void reComputeErrorAround();
public abstract void reComputeError();
if (fundamentalQuadric == null) recomputeFundamentalQuadric();
return fundamentalQuadric;
}
+ public void unApplyQuadricToNeighbor() {
+ if (nearest_in_other_mesh == null) return;
+ if (fundamentalQuadric == null) return;
+ nearest_in_other_mesh.unComputeError();
+ nearest_in_other_mesh.quadric = nearest_in_other_mesh.quadric.minus(fundamentalQuadric);
+ nearest_in_other_mesh.quadric_count--;
+ if (nearest_in_other_mesh.quadric_count==0)
+ nearest_in_other_mesh.quadric = Matrix.ZERO;
+ nearest_in_other_mesh.computeError();
+ nearest_in_other_mesh = null;
+ }
}