[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ControlledExtrudeTool.java, 1.6, 1.7
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-10-05 09:21:04
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28309/src/net/sourceforge/bprocessor/gl/tool Modified Files: ControlledExtrudeTool.java Log Message: Added same drag possibilities through walls as the normal extrude tool. Tried to make some clever space assignment, but as it is now it only happens when the extrusion is placed and not when it is created. This sould be fixed. Index: ControlledExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledExtrudeTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ControlledExtrudeTool.java 3 Oct 2007 10:03:50 -0000 1.6 --- ControlledExtrudeTool.java 5 Oct 2007 09:21:06 -0000 1.7 *************** *** 51,54 **** --- 51,56 ---- private double maxExtrude; private double minExtrude; + private Surface topSurface; + private double length; /** *************** *** 78,82 **** protected void moved(MouseEvent e) { glv.getView().makeTarget(null); ! findTarget(e, View.HANDLES); double x = e.getX(); double y = View.getHeight() - e.getY(); --- 80,86 ---- protected void moved(MouseEvent e) { glv.getView().makeTarget(null); ! ArrayList<Surface> starter = new ArrayList<Surface>(); ! starter.add(pressedSurface); ! findTarget(e, starter); double x = e.getX(); double y = View.getHeight() - e.getY(); *************** *** 101,108 **** //Find the plane to extrude to Plane p = null; ! if (target instanceof Surface && !affected.contains(target)) { Surface s = (Surface)target; ! if (Math.abs((Math.abs(s.normal().angle(normal)) - Math.PI / 2)) >= 0.05) { ! p = new Plane(normal.projectOnto(s.normal()), s.getFirstVertex()); } } --- 105,124 ---- //Find the plane to extrude to Plane p = null; ! if (target instanceof Surface) { Surface s = (Surface)target; ! if (affected.contains(s)) { ! Plane tmpP = s.plane(); ! findTarget(e, affected); ! if (target instanceof Surface) { ! Surface sur = (Surface)target; ! double dist = tmpP.distance(sur.getFirstVertex()); ! if (Math.abs(dist) < 0.001) { ! p = sur.plane(); ! } ! } ! } else { ! if (Math.abs((Math.abs(s.normal().angle(normal)) - Math.PI / 2)) >= 0.05) { ! p = new Plane(normal.projectOnto(s.normal()), s.getFirstVertex()); ! } } } *************** *** 114,123 **** // If the extrusion isn't generated generate it Vertex delta = current.vertex().minus(start.vertex()); ! double length = delta.length(); if (delta.angle(normal) > Math.PI / 2) { length *= -1; } ! Surface topSurface = pressedSurface.extrusionControlled(length, extrusion, v2dir); if (topSurface != pressedSurface) { extrusion.add(topSurface); --- 130,139 ---- // If the extrusion isn't generated generate it Vertex delta = current.vertex().minus(start.vertex()); ! length = delta.length(); if (delta.angle(normal) > Math.PI / 2) { length *= -1; } ! topSurface = pressedSurface.extrusionControlled(length, extrusion, v2dir); if (topSurface != pressedSurface) { extrusion.add(topSurface); *************** *** 208,215 **** excluded(new ArrayList()); Mesh m = new Mesh(extrusion); ! owner.insert(m); if (extrusion.isEmpty()) { owner.simplify(); } owner.changed(); Project.getInstance().checkpoint(); --- 224,260 ---- excluded(new ArrayList()); Mesh m = new Mesh(extrusion); ! m = owner.insert(m); if (extrusion.isEmpty()) { owner.simplify(); } + for (Surface s : m.surfaces()) { + if (s.equivalent(pressedSurface)) { + pressedSurface = s; + } else if (s.equivalent(topSurface)) { + topSurface = s; + } + + } + + if (pressedSurface != null) { + if (pressedSurface.getExterior() != null) { + if (length > 0) { + pressedSurface.assignFront(pressedSurface.getBackDomain()); + } else { + pressedSurface.assignBack(pressedSurface.getFrontDomain()); + } + } else { + if (length > 0) { + pressedSurface.assignFront(pressedSurface.getFrontDomain()); + } else { + pressedSurface.assignBack(pressedSurface.getBackDomain()); + } + } + } + if (topSurface != null) { + if (topSurface.getExterior() != null) { + Surface.mergeSpaceAssign(topSurface, topSurface.getExterior(), topSurface); + } + } owner.changed(); Project.getInstance().checkpoint(); *************** *** 244,250 **** --- 289,297 ---- v2dir.clear(); pressedSurface = null; + topSurface = null; dragPlane = null; normal = null; active = false; + length = 0; maxExtrude = Double.POSITIVE_INFINITY; minExtrude = Double.NEGATIVE_INFINITY; |