+ public void bindEdge(E e, Matrix m) {
+ //bind_to.add(e);
+
+ //assumes edges are identical length at binding time
+ e = e.pair;
+ Vec reflectionPlaneNormal = e.p2.p.minus(e.p1.p).norm();
+ float a = reflectionPlaneNormal.x;
+ float b = reflectionPlaneNormal.y;
+ float c = reflectionPlaneNormal.z;
+ Matrix reflectionMatrix =
+ new Matrix( 1-2*a*a, -2*a*b, -2*a*c, 0,
+ -2*a*b, 1-2*b*b, -2*b*c, 0,
+ -2*a*c, -2*b*c, 1-2*c*c, 0,
+ 0, 0, 0, 1);
+ /*
+ m = m.times(Matrix.translate(e.midpoint().minus(Point.ORIGIN))
+ .times(reflectionMatrix)
+ .times(Matrix.translate(Point.ORIGIN.minus(e.midpoint()))));
+ */
+ System.out.println(reflectionPlaneNormal);
+ System.out.println(" " + p1.p + " " + m.times(e.p1.p));
+ System.out.println(" " + p2.p + " " + m.times(e.p2.p));
+ if (m.times(e.p1.p).minus(p1.p).mag() > EPSILON) throw new Error();
+ if (m.times(e.p2.p).minus(p2.p).mag() > EPSILON) throw new Error();
+ this.bindTo(m, e);
+ }
+
+ public void dobind() {
+ //bind_to.dobind(this);
+ for(E e : (Iterable<E>)getBoundPeers()) {
+ if (e==this) continue;
+ p1.bindTo(getBindingMatrix(e), e.p1);
+ p2.bindTo(getBindingMatrix(e), e.p2);
+ }
+ }