[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool FinalMoveTool.java, 1.36, 1.37
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-11-26 18:15:23
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26981/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: added use of first coordinatesystem in union of instance as handle when moving instances... tried some matrix stuff to rotate into the coordinatesystem of the handle but without luck Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** FinalMoveTool.java 26 Nov 2007 10:30:53 -0000 1.36 --- FinalMoveTool.java 26 Nov 2007 18:15:07 -0000 1.37 *************** *** 195,199 **** private CoordinateSystem handle; private CoordinateSystem initialCoordinate; ! private Matrix translation; /** --- 195,199 ---- private CoordinateSystem handle; private CoordinateSystem initialCoordinate; ! private Matrix handleTranslation; /** *************** *** 206,211 **** this.handle = handle; this.initialCoordinate = instance.getInstanceAnchor().copy(); } ! /** * {@inheritDoc} --- 206,217 ---- this.handle = handle; this.initialCoordinate = instance.getInstanceAnchor().copy(); + handleTranslation = new Matrix(new double[]{ + handle.getI().getX(), handle.getI().getY(), handle.getI().getZ(), 0, + handle.getJ().getX(), handle.getJ().getY(), handle.getJ().getZ(), 0, + handle.getN().getX(), handle.getN().getY(), handle.getN().getZ(), 0, + handle.getOrigin().getX(), handle.getOrigin().getY(), handle.getOrigin().getZ(), 1, + }).invert(); } ! /** * {@inheritDoc} *************** *** 218,229 **** Surface surface = (Surface)current.object(); Vertex n = surface.normal(); - Vertex origin = surface.getFirstVertex(); if (!editor.getView().facingFront(surface)) { n = n.scale(-1); } ! CoordinateSystem cs = CoordinateSystem.systemFor(origin, n); CoordinateSystem anchor = instance.getInstanceAnchor(); ! anchor.setAttributes(cs.getAttributes()); anchor.setOrigin(current.vertex()); } else { // change i, j, n of the anchor back to its originals and then just move the delta --- 224,250 ---- Surface surface = (Surface)current.object(); Vertex n = surface.normal(); if (!editor.getView().facingFront(surface)) { n = n.scale(-1); } ! CoordinateSystem cs = CoordinateSystem.systemFor(current.vertex(), n); CoordinateSystem anchor = instance.getInstanceAnchor(); ! Vertex handleOffset = handle.center().scale(-1); ! ! Vertex i = handleTranslation.multiply(cs.getI(), false); ! Vertex j = handleTranslation.multiply(cs.getJ(), false); ! Vertex k = handleTranslation.multiply(cs.getN(), false); ! anchor.setIJN(i, j, k); anchor.setOrigin(current.vertex()); + anchor.setOrigin(anchor.unTranslate(handleOffset)); + /* + Matrix movement = handleTranslation.copy(); + movement.translate(x, y, z); + Vertex i = handleTranslation.multiply(cs.getI(), false); + Vertex j = handleTranslation.multiply(cs.getJ(), false); + Vertex k = handleTranslation.multiply(cs.getN(), false); + anchor.setIJN(i, j, k); + Vertex center = handleTranslation.multiply(cs.center(), false); + anchor.setOrigin(center); + */ } else { // change i, j, n of the anchor back to its originals and then just move the delta *************** *** 499,503 **** Space space = (Space)work; if (space.isInstance()) { ! mover = new InstanceMove(space, space.getInstanceAnchor()); } } --- 520,532 ---- Space space = (Space)work; if (space.isInstance()) { ! CoordinateSystem anchor = null; ! for (CoordinateSystem currentSystem : space.getProto().getCoordinateSystems()) { ! anchor = currentSystem; ! break; ! } ! if (anchor == null) { ! anchor = space.getInstanceAnchor(); ! } ! mover = new InstanceMove(space, anchor); } } |