Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool MultiExtrudeTool.java,1.4,1.5
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-02-23 14:05:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv660/src/net/sourceforge/bprocessor/gl/tool Modified Files: MultiExtrudeTool.java Log Message: Multiextrude work partially but is not activated yet... Edge and Vertex getAtt changed to not printing and Surface extrude changed a bit Index: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MultiExtrudeTool.java 16 Feb 2006 20:55:14 -0000 1.4 --- MultiExtrudeTool.java 23 Feb 2006 14:05:22 -0000 1.5 *************** *** 13,21 **** import java.util.HashMap; import java.util.HashSet; - import java.util.List; import java.util.Map; import java.util.Set; import java.util.Iterator; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.Transformation; --- 13,22 ---- import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.Iterator; + import org.apache.log4j.Logger; + import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.Transformation; *************** *** 32,36 **** */ public class MultiExtrudeTool extends SelectTool { ! /** The dragSurface and extrudesurface */ private Surface top, extrudeSurface; --- 33,39 ---- */ public class MultiExtrudeTool extends SelectTool { ! /** The logger */ ! private static Logger log = Logger.getLogger(MultiExtrudeTool.class); ! /** The dragSurface and extrudesurface */ private Surface top, extrudeSurface; *************** *** 42,50 **** private Plane dragPlane; - /** The vertices to extrude */ - private List vertices; - /** The previous coordinate */ ! private int prevX, prevY; /** --- 45,53 ---- private Plane dragPlane; /** The previous coordinate */ ! private int pressX, pressY; ! ! /** The previous position of the drag */ ! private double t; /** *************** *** 64,67 **** --- 67,71 ---- extrudeSurface = null; top = null; + t = 0; v2dir = new HashMap(); super.pressed(e); *************** *** 70,76 **** extrudeSurface = (Surface)target; View view = glv.getView(); ! Transformation trans = view.transformation(); ! double x = prevX; ! double y = View.getHeight() - prevY; Vertex near = new Vertex(x, y, 0.0); Vertex far = new Vertex(x, y, 1.0); --- 74,82 ---- extrudeSurface = (Surface)target; View view = glv.getView(); ! Transformation trans = view.transformation(); ! pressX = e.getX(); ! pressY = e.getY(); ! double x = pressX; ! double y = View.getHeight() - pressY; Vertex near = new Vertex(x, y, 0.0); Vertex far = new Vertex(x, y, 1.0); *************** *** 99,107 **** } View view = glv.getView(); ! Vertex from = view.toPlaneCoords(new double[] {prevX, prevY}, dragPlane); Vertex to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragPlane); Vertex delta = to.minus(from); double normDotDelta = normal.dot(delta); ! move(v2dir.values(), normDotDelta); } } --- 105,115 ---- } View view = glv.getView(); ! Vertex from = view.toPlaneCoords(new double[] {pressX, pressY}, dragPlane); Vertex to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragPlane); Vertex delta = to.minus(from); double normDotDelta = normal.dot(delta); ! moveTo(v2dir.values(), normDotDelta); ! } else { ! // TODO Tell somehow that the extrusion were illigal } } *************** *** 110,123 **** * Move a collection of vertex, direction pairs * @param which The colelction of pairs ! * @param delta The amount of the direction each vertex should move */ ! private void move(Collection which, double delta) { Iterator iter = which.iterator(); while (iter.hasNext()) { Direction d = (Direction)iter.next(); Vertex movement = d.getDirection(); ! movement.scale(delta); ! d.getVertex().move(movement.getX(), movement.getY(), movement.getZ()); } } --- 118,135 ---- * Move a collection of vertex, direction pairs * @param which The colelction of pairs ! * @param to The amount of the direction each vertex should move */ ! private void moveTo(Collection which, double to) { ! double delta = t - to; Iterator iter = which.iterator(); while (iter.hasNext()) { Direction d = (Direction)iter.next(); Vertex movement = d.getDirection(); ! log.info(d.getVertex() + " blev flyttet " + movement); ! Vertex v = movement.copy(); ! v.scale(delta); ! d.getVertex().move(v.getX(), v.getY(), v.getZ()); } + t = to; } *************** *** 128,131 **** --- 140,144 ---- protected void released(MouseEvent e) { super.released(e); + } *************** *** 139,143 **** Map e2e = new HashMap(); // edge to edge map Map e2s = new HashMap(); // edge to surface map - Map v2v = new HashMap(); // vertex to extruded edge map v2dir = new HashMap(); // vertex to direction map Map v2e = new HashMap(); // vertex to edge map --- 152,155 ---- *************** *** 148,152 **** while (iter.hasNext()) { if (!(iter.next() instanceof Surface)) { - extrudeSurface = null; return null; } --- 160,163 ---- *************** *** 154,163 **** iter = c.iterator(); while (iter.hasNext()) { ! // FIXME: following lines cannot compile ! // Surface s = ((Surface)iter.next()).extrude(1, elements, e2e, v2e, e2s, v2dir, v2v); ! // if (extrudeSurface == null) { ! // extrudeSurface = s; ! // } ! // elements.add(s); } return elements; --- 165,175 ---- iter = c.iterator(); while (iter.hasNext()) { ! Surface cur = (Surface)iter.next(); ! Surface s = cur.extrude(1, elements, e2e, v2e, e2s, v2dir); ! if (cur == extrudeSurface) { ! // Set the top to the extruded surface of target ! top = s; ! } ! elements.add(s); } return elements; |