[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ExtrusionTool.java,1.2,1.3
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2005-08-19 10:31:39
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19875 Modified Files: ExtrusionTool.java Log Message: added support for 3D Extrusion Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExtrusionTool.java 5 Aug 2005 11:25:18 -0000 1.2 --- ExtrusionTool.java 19 Aug 2005 10:31:29 -0000 1.3 *************** *** 8,11 **** --- 8,12 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.kernel.notification.Notification; *************** *** 57,78 **** } if (dragSurface != null) { ! Vertex normal = dragSurface.normal(); ! if (normal != null) { ! double[] second = glv.getView().toCanvasCoords(new double[] {e.getX(), e.getY()}); normal.scale(1 / normal.length()); ! Vertex proj = dragSurface.projection(second); ! List l = Util.traverse(dragSurface); for (int count = 0; l != null && count < l.size(); count++) { Vertex v = (Vertex)l.get(count); ! updateVertex(v, new double[] {v.getX() + proj.getX(), ! v.getY() + proj.getY(), ! v.getZ() + proj.getZ()}); } } } } } /** * Checks if a surface is extrudeable --- 58,99 ---- } if (dragSurface != null) { ! if (viewType != View.VIEW_3D) { ! Vertex normal = dragSurface.normal(); ! if (normal != null) { ! double[] second = glv.getView().toCanvasCoords(new double[] {e.getX(), e.getY()}); ! normal.scale(1 / normal.length()); ! Vertex proj = dragSurface.projection(second); ! ! List l = Util.traverse(dragSurface); ! for (int count = 0; l != null && count < l.size(); count++) { ! Vertex v = (Vertex)l.get(count); ! updateVertex(v, new double[] {v.getX() + proj.getX(), ! v.getY() + proj.getY(), ! v.getZ() + proj.getZ()}); ! } ! } ! } else { ! double dX = pressPos[0] - e.getX(); ! double dY = pressPos[1] - e.getY(); ! double delta = (dX - dY) / 60; ! Vertex normal = dragSurface.normal(); normal.scale(1 / normal.length()); ! normal.scale(delta); List l = Util.traverse(dragSurface); + //moving the dragged surface along its normal vector for (int count = 0; l != null && count < l.size(); count++) { Vertex v = (Vertex)l.get(count); ! updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); } } } + pressPos[0] = e.getX(); + pressPos[1] = e.getY(); } } + /** * Checks if a surface is extrudeable *************** *** 126,130 **** /** ! * Do alle the initial extrusion stuff */ private void createExtension() { --- 147,151 ---- /** ! * Do all the initial extrusion stuff */ private void createExtension() { |