- private void glNormal(GL gl) {
- Vec norm = norm();
- gl.glNormal3f(norm.x, norm.y, norm.z);
- }
-
- public void recomputeFundamentalQuadric() {
- unApplyQuadricToNeighbor();
- if (quadricStale || fundamentalQuadric==null) {
- Matrix m = Matrix.ZERO;
- int count = 0;
- for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) {
- T t = e.t;
- m = m.plus(t.norm().fundamentalQuadric(t.centroid()));
- count++;
- }
- quadricStale = false;
- fundamentalQuadric = m.times(1/(float)count);
- }
- applyQuadricToNeighbor();
- }
-
- 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;