X-Git-Url: http://git.megacz.com/?p=anneal.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fqfat%2FMesh.java;h=3a250c7ede7afaeef37bd504df27ce037824526c;hp=f5ce535c1aef4f423e02c76f9884f7905979a9c4;hb=eabe4f7acd947415f183290dc3269b2502a25a1c;hpb=9668f77ce3eeed3a393345c357818e1f85b3a637 diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index f5ce535..3a250c7 100644 --- a/src/edu/berkeley/qfat/Mesh.java +++ b/src/edu/berkeley/qfat/Mesh.java @@ -364,7 +364,7 @@ public class Mesh implements Iterable { float minangle = (float)(Math.PI * 0.8); //nerror += ((ang / Math.PI)*(ang/Math.PI)) * e.length() * 0.05; - nerror += (1-e.t.quality())*0.0001; + //nerror += (1-e.t.quality())*0.0001; if (ang > minangle) nerror += (ang - minangle); //System.out.println(((ang / Math.PI)*(ang/Math.PI)) * 0.000001); @@ -399,27 +399,21 @@ public class Mesh implements Iterable { // t1 = t1.getMatrix(t2) * t2 // M * t1 = M * t1.getMatrix(t2) * t2 + /* if (bindingGroup!=null && this != bindingGroup.getMaster()) { Matrix m2 = getBindingMatrix(bindingGroup.getMaster()); Vec v2 = m2.times(vv.plus(getPoint())).minus(m2.times(getPoint())); return ((Vertex)bindingGroup.getMaster()).move(v2, ignoreProblems); } + */ Point op = this.p; - Point pp = vv.plus(getPoint()); - if (bindingGroup != null) { - /* - for(int i=0; i<20 ; i++) { - Point v2 = getConstraint().times(pp); - pp = pp.midpoint(v2); - //System.out.println(m.minus(m2)); - } - */ - //pp = getConstraint().times(pp); - } - //pp = pp.minus(op).norm().times(vv.mag()).plus(op); - ok = false; - Point pt = pp; + Point pt = vv.plus(getPoint()); + Point pp = pt; + pt = getBindingConstraint().getProjection(pp); + if (pt==null) return false; + System.out.println(pt.minus(pp).mag() + " " + getBindingConstraint()); + for(Vertex v : (Iterable)getBoundPeers()) { Point pt2 = v.getBindingMatrix(this).times(pt); /* @@ -621,7 +615,7 @@ public class Mesh implements Iterable { edu.berkeley.qfat.geom.BindingGroup newBindingGroup = (edu.berkeley.qfat.geom.BindingGroup)newBindingGroup_; if (newBindingGroup==null) return; - if (this==newBindingGroup.getMaster()) return; + //if (this==newBindingGroup.getMaster()) return; HashSet nbg = new HashSet(); for(E eother : (Iterable)newBindingGroup) nbg.add(eother); for(E eother : nbg) { @@ -697,8 +691,10 @@ public class Mesh implements Iterable { if (e==this) continue; v1.bindTo(getBindingMatrix(e), e.v1); v2.bindTo(getBindingMatrix(e), e.v2); + /* e.v1.setConstraint(getConstraint()); e.v2.setConstraint(getConstraint()); + */ } }