[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ExtrusionTool.java,1.3,1.4
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2005-08-30 12:49:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2414 Modified Files: ExtrusionTool.java Log Message: Changed to extrution work better with holes Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExtrusionTool.java 19 Aug 2005 10:31:29 -0000 1.3 --- ExtrusionTool.java 30 Aug 2005 12:49:34 -0000 1.4 *************** *** 56,60 **** createExtension(); } ! } if (dragSurface != null) { if (viewType != View.VIEW_3D) { --- 56,60 ---- createExtension(); } ! } if (dragSurface != null) { if (viewType != View.VIEW_3D) { *************** *** 72,76 **** v.getZ() + proj.getZ()}); } ! } } else { double dX = pressPos[0] - e.getX(); --- 72,76 ---- v.getZ() + proj.getZ()}); } ! } } else { double dX = pressPos[0] - e.getX(); *************** *** 88,91 **** --- 88,106 ---- v.getZ() + normal.getZ()}); } + //also moving any inner surfaces + Set innerSurfaces = dragSurface.getInnerSurfaces(); + if (innerSurfaces != null) { + Iterator innerIt = innerSurfaces.iterator(); + while (innerIt.hasNext()) { + Surface innerSurf = (Surface)innerIt.next(); + List verticies = Util.traverse(innerSurf); + for (int count = 0; verticies != null && count < verticies.size(); count++) { + Vertex v = (Vertex)verticies.get(count); + updateVertex(v, new double[] {v.getX() + normal.getX(), + v.getY() + normal.getY(), + v.getZ() + normal.getZ()}); + } + } + } } } *************** *** 102,106 **** */ private boolean isExtrudeable(Surface s) { ! if (s == null) { return false; } --- 117,121 ---- */ private boolean isExtrudeable(Surface s) { ! if (s == null || s.getIsInner()) { return false; } *************** *** 147,158 **** /** ! * Do all the initial extrusion stuff */ ! private void createExtension() { Edge previousEdge = null; Vertex previousVertex = null; Edge first = null; List newEdges = new ArrayList(); ! List edges = selectedSurface.getEdges(); List top = new ArrayList(edges.size()); Iterator i = edges.iterator(); --- 162,175 ---- /** ! * Extends a single surface to a corresponding 3D figure. ! * @param extendSurf the surface to extend. ! * @return the top surface of the extended surface. */ ! private Surface extendSurface(Surface extendSurf) { Edge previousEdge = null; Vertex previousVertex = null; Edge first = null; List newEdges = new ArrayList(); ! List edges = extendSurf.getEdges(); List top = new ArrayList(edges.size()); Iterator i = edges.iterator(); *************** *** 215,219 **** while (i.hasNext() && !found) { Edge temp = (Edge)i.next(); ! if (selectedSurface.getEdges().contains(temp) && !temp.equals(current)) { current = temp; found = true; --- 232,236 ---- while (i.hasNext() && !found) { Edge temp = (Edge)i.next(); ! if (extendSurf.getEdges().contains(temp) && !temp.equals(current)) { current = temp; found = true; *************** *** 222,226 **** } } ! dragSurface = createSurface(top); Notification n = new Notification(Notification.SURFACE_SELECTED, dragSurface.getId()); Notifier.getInstance().sendNotification(n); --- 239,261 ---- } } ! return createSurface(top); ! } ! ! /** ! * Do all the initial extrusion stuff ! */ ! private void createExtension() { ! Surface top = extendSurface(selectedSurface); ! Set innerSurfaces = selectedSurface.getInnerSurfaces(); ! if (innerSurfaces != null) { ! Iterator innerIt = innerSurfaces.iterator(); ! while (innerIt.hasNext()) { ! Surface innerSurf = (Surface)innerIt.next(); ! Surface newInnerSurf = extendSurface(innerSurf); ! top.addHole(newInnerSurf); ! newInnerSurf.setIsInner(true); ! } ! } ! dragSurface = top; Notification n = new Notification(Notification.SURFACE_SELECTED, dragSurface.getId()); Notifier.getInstance().sendNotification(n); |