+ public boolean intersects(T t) { return t.intersects(p1.p, p2.p); }
+
+ public void bindingGroupChanged(edu.berkeley.qfat.geom.BindingGroup newBindingGroup_) {
+ edu.berkeley.qfat.geom.BindingGroup<E> newBindingGroup =
+ (edu.berkeley.qfat.geom.BindingGroup<E>)newBindingGroup_;
+ if (newBindingGroup==null) return;
+ if (this==newBindingGroup.getMaster()) return;
+ /*
+ for(E eother : (Iterable<E>)newBindingGroup) {
+ this.next.bindTo(newBindingGroup.getMatrix(eother), eother.next);
+ this.prev.bindTo(newBindingGroup.getMatrix(eother), eother.prev);
+ }
+ */
+ }
+
+ public float stretchRatio() {
+ Vertex nearest = error_against.nearest(midpoint());
+ float nearest_distance = midpoint().distance(nearest.p);
+ float other_distance =
+ (p1.p.distance(error_against.nearest(p1.p).p)+
+ p2.p.distance(error_against.nearest(p2.p).p))/2;
+ return nearest_distance/other_distance;
+ }
+ public float comparator() {
+ return length();
+ //return t==null?0:(1/t.aspect());
+ }
+ public int compareTo(E e) {
+ return e.comparator() > comparator() ? 1 : -1;
+ }
+ 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);
+ }
+