X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fqfat%2FMesh.java;h=7c3867295ba1eddbe011cd812f1d739ecd659288;hb=f96695d8b7fa75542b9c399b1caf0266dbf30af8;hp=d56e2a0d639a827160e9adbd35611e0d7515c21e;hpb=2a2e64829786ee415fd0c0f16957c55e174b793b;p=anneal.git diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index d56e2a0..7c38672 100644 --- a/src/edu/berkeley/qfat/Mesh.java +++ b/src/edu/berkeley/qfat/Mesh.java @@ -19,9 +19,9 @@ public class Mesh implements Iterable { private RTree triangles = new RTree(); private PointSet vertices = new PointSet(); - - public boolean option_wireframe = false; + public boolean option_wireframe = false; public boolean option_errorNormals = false; + public boolean option_selectable = true; public void render(GL gl, Matrix m) { if (option_wireframe) { @@ -247,7 +247,7 @@ public class Mesh implements Iterable { setError(nerror); } - public boolean move(Matrix m, boolean ignoreProblems) { + public boolean move(Vec vv, boolean ignoreProblems) { boolean good = true; @@ -258,21 +258,26 @@ public class Mesh implements Iterable { // M * t1 = M * t1.getMatrix(t2) * t2 if (bindingGroup!=null && this != bindingGroup.getMaster()) { - Matrix v = getBindingMatrix(bindingGroup.getMaster()); - return ((Vertex)bindingGroup.getMaster()).move(v.inverse().times(m).times(v), ignoreProblems); + 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) { - Matrix m2 = null; - for(int i=0; i<20 && !m.equals(m2); i++) { - m2 = m.times(getConstraint()); + /* + for(int i=0; i<20 ; i++) { + Point p2 = getConstraint().times(pp); + pp = pp.midpoint(p2); //System.out.println(m.minus(m2)); } - if (!m.equals(m2)) return true; + */ + pp = getConstraint().times(pp); } + pp = pp.minus(op).norm().times(vv.mag()).plus(op); ok = false; - Point op = this.p; - Point pt = m.times(this.p); + Point pt = pp; for(Vertex v : (Iterable)getBoundPeers()) { Point pt2 = v.getBindingMatrix(this).times(pt); /* @@ -304,7 +309,6 @@ public class Mesh implements Iterable { unApplyQuadricToNeighbor(); - boolean illegalbefore = illegal; illegal = false; /*