[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ExtrusionTool.java, 1.64, 1.65 Abstra
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-08-20 12:34:28
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14138/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrusionTool.java AbstractPencil.java Log Message: Improved on extrude tool Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** ExtrusionTool.java 9 Aug 2007 16:04:29 -0000 1.64 --- ExtrusionTool.java 20 Aug 2007 12:33:37 -0000 1.65 *************** *** 167,205 **** protected void moved(MouseEvent e) { if (extrudesurface != null) { to = glv.getView().toPlaneCoords(e.getX(), e.getY(), dragplane); Vertex normal = extrudesurface.normal(); ontoPlane = null; ! Set<Geometric> elements = new HashSet<Geometric>(); if (extrusion != null) { elements.addAll(extrusion); elements.addAll(Surface.edges(extrusion)); elements.add(extrudesurface); } ! Set<Surface> ignore = new HashSet<Surface>(2); ! ignore.add(extrudesurface); ! if (extrudesurface.getExterior() != null) { ! ignore.add(extrudesurface.getExterior()); ! } ! findTarget(e, ignore); { ! if (target instanceof Surface && extrusion != null && !extrusion.contains(target)) { Surface surface = (Surface) target; ! if (!elements.contains(surface)) { Vertex n = surface.normal(); Vertex cross = normal.cross(n); if (cross.isZero()) { ! Vertex v = surface.getFirstVertex(); ! if (!extrudesurface.plane().contains(v)) { ! to = v; ! } calcDistCallExtrude(to, from, normal); } else { ontoPlane = surface.plane(); if (Math.abs(ontoPlane.normal().dot(normal)) <= 0.1) { calcDistCallExtrude(to, from, normal); } else { extrudeOnto(ontoPlane, all, false); } } } } else if (target instanceof Edge) { --- 167,217 ---- protected void moved(MouseEvent e) { if (extrudesurface != null) { + glv.getView().removeTempVertex(to); to = glv.getView().toPlaneCoords(e.getX(), e.getY(), dragplane); Vertex normal = extrudesurface.normal(); ontoPlane = null; ! elements.clear(); if (extrusion != null) { elements.addAll(extrusion); elements.addAll(Surface.edges(extrusion)); elements.add(extrudesurface); + if (extrudesurface.getExterior() != null) { + elements.add(extrudesurface.getExterior()); + } } ! excluded.clear(); ! excluded.add(extrudesurface); ! findTarget(e, excluded); { ! if (target instanceof Surface) { Surface surface = (Surface) target; ! if (!elements.contains(target)) { Vertex n = surface.normal(); Vertex cross = normal.cross(n); if (cross.isZero()) { ! to = glv.getView().toPlaneCoords(e.getX(), e.getY(), surface.plane()); ! current = new Intersection(to, Intersection.SURFACE, surface); calcDistCallExtrude(to, from, normal); } else { ontoPlane = surface.plane(); if (Math.abs(ontoPlane.normal().dot(normal)) <= 0.1) { + current = new Intersection(to, Intersection.PLANE_INTERSECTION, surface); calcDistCallExtrude(to, from, normal); } else { + to = glv.getView().toPlaneCoords(e.getX(), e.getY(), ontoPlane); + current = new Intersection(to, Intersection.PLANE_INTERSECTION, ontoPlane); extrudeOnto(ontoPlane, all, false); } } + } else { + excluded.addAll(elements); + findTarget(e, excluded); + if (target instanceof Surface && surface.plane().contains((Surface)target)) { + // do nothing + current = new Intersection(to, Intersection.SURFACE, target); + } else { + current = new Intersection(to, Intersection.PLANE_INTERSECTION, dragplane); + calcDistCallExtrude(to, from, normal); + } } } else if (target instanceof Edge) { *************** *** 209,212 **** --- 221,227 ---- if (!extrudesurface.plane().contains(v)) { to = v; + current = new Intersection(to, Intersection.EDGE_MIDPOINT, edge); + } else { + current = new Intersection(to, Intersection.PLANE_INTERSECTION, to); } } *************** *** 215,223 **** --- 230,245 ---- if (!elements.contains(target)) { to = (Vertex)target; + current = new Intersection(to, Intersection.VERTEX, to); + } else { + current = new Intersection(to, Intersection.PLANE_INTERSECTION, to); } calcDistCallExtrude(to, from, normal); } else { + current = new Intersection(to, Intersection.PLANE_INTERSECTION, to); calcDistCallExtrude(to, from, normal); } + float[] color = targetColor(current); + glv.getView().addTempVertex(to); + glv.getView().changeColor(to, color); } } else if (extrudeEdges != null) { *************** *** 355,358 **** --- 377,381 ---- start = findIntersection(e); from = start.vertex(); + start = null; setTip(secondClickTip()); } else if (extrudesurface != null) { *************** *** 455,458 **** --- 478,482 ---- */ public void cleanUp() { + glv.getView().removeTempVertex(to); all = false; dragplane = null; Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** AbstractPencil.java 27 Jun 2007 00:33:53 -0000 1.84 --- AbstractPencil.java 20 Aug 2007 12:33:37 -0000 1.85 *************** *** 624,628 **** * @return */ ! private float[] targetColor(Intersection intersection) { float[] targetColor = View.TARGET_COLOR; switch (intersection.type()) { --- 624,628 ---- * @return */ ! public float[] targetColor(Intersection intersection) { float[] targetColor = View.TARGET_COLOR; switch (intersection.type()) { |