- if (nearest_in_other_mesh == null) {
- nearest_in_other_mesh = score_against.nearest(p);
-
- // don't attract to vertices that face the other way
- if (nearest_in_other_mesh.e == null || nearest_in_other_mesh.norm().dot(norm()) < 0) {
- nearest_in_other_mesh = null;
- } else {
- nearest_in_other_mesh.unComputeError();
- nearest_in_other_mesh.quadric = nearest_in_other_mesh.quadric.plus(fundamentalQuadric());
- nearest_in_other_mesh.quadric_count++;
- nearest_in_other_mesh.computeError();
- }
+ if (nearest_in_other_mesh != null) throw new Error();
+
+ nearest_in_other_mesh = new_nearest;
+
+ // don't attract to vertices that face the other way
+ if (nearest_in_other_mesh.e == null || nearest_in_other_mesh.norm().dot(norm()) < 0) {
+ nearest_in_other_mesh = null;
+ } else {
+ nearest_in_other_mesh.unComputeError();
+ nearest_in_other_mesh.quadric = nearest_in_other_mesh.quadric.plus(fundamentalQuadric());
+ nearest_in_other_mesh.quadric_count++;
+ nearest_in_other_mesh.computeError();