bprocessor-commit Mailing List for B-processor (Page 150)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael L. <he...@us...> - 2005-11-25 17:48:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31591/src/net/sourceforge/bprocessor/gl/model Modified Files: ClippingPlane.java Log Message: Move of clipplane Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model/ClippingPlane.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ClippingPlane.java 25 Nov 2005 17:03:32 -0000 1.3 --- ClippingPlane.java 25 Nov 2005 17:48:08 -0000 1.4 *************** *** 60,64 **** */ public Vertex origin() { ! return system.origin(); } --- 60,72 ---- */ public Vertex origin() { ! Vertex origin = origin = system.origin(); ! // FIXME Interning the origin to give it an ID.. ! // It needs an ID to be in a hashtable, but this ! // means that the origin point will be drawn an ! // clickable etc. ! if (origin.getId() == null) { ! Project.getInstance().intern(origin); ! } ! return origin; } |
From: Michael L. <he...@us...> - 2005-11-25 17:48:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31591/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java Log Message: Move of clipplane Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** MoveTool.java 25 Nov 2005 10:20:11 -0000 1.17 --- MoveTool.java 25 Nov 2005 17:48:08 -0000 1.18 *************** *** 8,11 **** --- 8,12 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.model.ClippingPlane; import net.sourceforge.bprocessor.gl.view.AbstractView; import net.sourceforge.bprocessor.gl.view.Transformation; *************** *** 95,98 **** --- 96,117 ---- } } + } else if (o instanceof ClippingPlane) { + ClippingPlane plane = (ClippingPlane) o; + vertices.add(plane.origin()); + } + } + + /** + * Update selection + * + */ + protected void update() { + Iterator iter = selection.iterator(); + while (iter.hasNext()) { + Object o = iter.next(); + if (o instanceof ClippingPlane) { + ClippingPlane plane = (ClippingPlane) o; + plane.update(); + } } } *************** *** 142,145 **** --- 161,167 ---- inner = sel.getIsInner(); temp = sel.plane(); + } else if (o instanceof ClippingPlane) { + ClippingPlane clippingplane = (ClippingPlane) o; + temp = clippingplane.getPlane(); } // make a orthogonal plane to the current one *************** *** 208,211 **** --- 230,234 ---- from.move(delta.getX(), delta.getY(), delta.getZ()); glv.setLength(from.minus(initial).length()); + update(); } |
From: Michael L. <he...@us...> - 2005-11-25 17:03:40
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22647/src/net/sourceforge/bprocessor/gl/model Modified Files: ClippingPlane.java Log Message: ClippingPlane Defined by its coordinate system - ClippinPlane.update recalculates corners and plane Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model/ClippingPlane.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ClippingPlane.java 6 Nov 2005 16:33:44 -0000 1.2 --- ClippingPlane.java 25 Nov 2005 17:03:32 -0000 1.3 *************** *** 44,49 **** public ClippingPlane(CoordinateSystem system) { this.system = system; ! this.plane = system.plane(); ! findCorners(); } --- 44,48 ---- public ClippingPlane(CoordinateSystem system) { this.system = system; ! update(); } *************** *** 57,60 **** --- 56,76 ---- /** + * Getter for the origin + * @return The origin + */ + public Vertex origin() { + return system.origin(); + } + + /** + * Update this clipping from the defining coordinatesystem attribute + * + */ + public void update() { + plane = system.plane(); + findCorners(); + } + + /** * Set the number clipping plane this plane represents in the GL * @param number The clipping plane number |
From: Michael L. <he...@us...> - 2005-11-25 10:20:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4684/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java Log Message: Movetool now collects vertices to move in a set to avoid moving the same vertex more than once Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** MoveTool.java 7 Nov 2005 07:21:21 -0000 1.16 --- MoveTool.java 25 Nov 2005 10:20:11 -0000 1.17 *************** *** 21,25 **** --- 21,27 ---- import java.util.Collection; + import java.util.HashSet; import java.util.Iterator; + import java.util.Set; import org.apache.log4j.Logger; *************** *** 58,61 **** --- 60,66 ---- /** The plane to drag according to */ private Plane dragPlane; + + /** The set of vertices to move **/ + private Set vertices; /** *************** *** 67,71 **** super(glv, cursor); } ! /** * Invoked when a mouse button has been pressed on a component. --- 72,100 ---- super(glv, cursor); } ! ! /** ! * Collect vertices from object ! * @param o The object ! * @param vertices The vertices ! */ ! private void collect(Object o, Set vertices) { ! if (o instanceof Vertex) { ! vertices.add(o); ! } else if (o instanceof Edge) { ! Edge edge = (Edge) o; ! vertices.add(edge.getFrom()); ! vertices.add(edge.getTo()); ! } else if (o instanceof Surface) { ! Surface surface = (Surface) o; ! vertices.addAll(surface.getVertices()); ! if (surface.getInnerSurfaces() != null) { ! Iterator iter = surface.getInnerSurfaces().iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! collect(current, vertices); ! } ! } ! } ! } /** * Invoked when a mouse button has been pressed on a component. *************** *** 82,85 **** --- 111,125 ---- parentPos = new Vertex("parent", initial.getX(), initial.getY(), initial.getZ()); from = new Vertex("from", initial.getX(), initial.getY(), initial.getZ()); + + vertices = new HashSet(); + Iterator iter = selection.iterator(); + while (iter.hasNext()) { + collect(iter.next(), vertices); + } + // There is a delay before selection has been updated with target + // because asynch notifications are being used to update selection. + // TODO fix it + // Meanwhile just collect points from target. + collect(target, vertices); } } *************** *** 128,131 **** --- 168,172 ---- dragPlane = null; parentPos = null; + vertices = null; } *************** *** 164,168 **** } ! move(selection, delta); from.move(delta.getX(), delta.getY(), delta.getZ()); glv.setLength(from.minus(initial).length()); --- 205,209 ---- } ! move(vertices, delta); from.move(delta.getX(), delta.getY(), delta.getZ()); glv.setLength(from.minus(initial).length()); |
From: Michael L. <he...@us...> - 2005-11-24 13:51:08
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26039/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: More rotatation Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** PencilTool.java 24 Nov 2005 13:40:56 -0000 1.38 --- PencilTool.java 24 Nov 2005 13:50:54 -0000 1.39 *************** *** 27,31 **** import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Geometry; - import net.sourceforge.bprocessor.model.Matrix; import java.util.Iterator; --- 27,30 ---- *************** *** 499,527 **** /** - * Rotate - * @param angle The angle - * @param x The x - * @param y The y - * @param z The z - * @param vector The vector to rotate - * @param center The center of rotation - */ - private void rotate(double angle, double x, double y, double z, - double[] vector, double[] center) { - - double[] v = new double[4]; - - v[0] = vector[0] - center[0]; - v[1] = vector[1] - center[1]; - v[2] = vector[2] - center[2]; - v[3] = 1; - Matrix rotation = Matrix.rotation(angle, x, y, z); - v = rotation.multiply(v); - vector[0] = v[0] + center[0]; - vector[1] = v[1] + center[1]; - vector[2] = v[2] + center[2]; - } - - /** * Invoked when a key has been pressed. Lets user delete what is selected. * @param e The KeyEvent --- 498,501 ---- *************** *** 633,643 **** } if (e.isShiftDown()) { ! rotate(angle, 0, 0, 1, camera, center); } else if (e.isAltDown()) { ! rotate(angle, roll[0], roll[1], roll[2], center, camera); } else { ! rotate(angle, 0, 0, 1, camera, pivot); ! rotate(angle, 0, 0, 1, center, pivot); ! rotate(angle, 0, 0, 1, roll, new double[]{0, 0, 0}); } glv.repaint(); --- 607,617 ---- } if (e.isShiftDown()) { ! Geometry.rotate(angle, 0, 0, 1, camera, center); } else if (e.isAltDown()) { ! Geometry.rotate(angle, roll[0], roll[1], roll[2], center, camera); } else { ! Geometry.rotate(angle, 0, 0, 1, camera, pivot); ! Geometry.rotate(angle, 0, 0, 1, center, pivot); ! Geometry.rotate(angle, 0, 0, 1, roll, new double[]{0, 0, 0}); } glv.repaint(); *************** *** 673,683 **** } if (e.isShiftDown()) { ! rotate(angle, x, y, z, camera, center); } else if (e.isAltDown()) { ! rotate(angle, x, y, z, center, camera); } else { ! rotate(angle, x, y, z, camera, pivot); ! rotate(angle, x, y, z, center, pivot); ! rotate(angle, x, y, z, roll, zero); } --- 647,657 ---- } if (e.isShiftDown()) { ! Geometry.rotate(angle, x, y, z, camera, center); } else if (e.isAltDown()) { ! Geometry.rotate(angle, x, y, z, center, camera); } else { ! Geometry.rotate(angle, x, y, z, camera, pivot); ! Geometry.rotate(angle, x, y, z, center, pivot); ! Geometry.rotate(angle, x, y, z, roll, zero); } |
From: Michael L. <he...@us...> - 2005-11-24 13:50:31
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25982/src/net/sourceforge/bprocessor/model Modified Files: Geometry.java Log Message: Added Geometry.rotate Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Geometry.java 17 Nov 2005 18:10:25 -0000 1.5 --- Geometry.java 24 Nov 2005 13:50:22 -0000 1.6 *************** *** 67,70 **** --- 67,96 ---- return null; } + + /** + * Rotate + * @param angle The angle + * @param x The x + * @param y The y + * @param z The z + * @param vector The vector to rotate + * @param center The center of rotation + */ + public static void rotate(double angle, double x, double y, double z, + double[] vector, double[] center) { + + double[] v = new double[4]; + + v[0] = vector[0] - center[0]; + v[1] = vector[1] - center[1]; + v[2] = vector[2] - center[2]; + v[3] = 1; + Matrix rotation = Matrix.rotation(angle, x, y, z); + v = rotation.multiply(v); + vector[0] = v[0] + center[0]; + vector[1] = v[1] + center[1]; + vector[2] = v[2] + center[2]; + } + /** |
From: Michael L. <he...@us...> - 2005-11-24 13:41:18
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23978/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: More rotation testing Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** PencilTool.java 24 Nov 2005 10:31:22 -0000 1.37 --- PencilTool.java 24 Nov 2005 13:40:56 -0000 1.38 *************** *** 626,646 **** double[] roll = view.getRoll(); - roll[0] = 0; - roll[1] = 0; - roll[2] = 1; - double angle; if (e.getKeyCode() == KeyEvent.VK_LEFT) { ! angle = Math.PI / 6; } else { ! angle = -Math.PI / 6; } if (e.isShiftDown()) { rotate(angle, 0, 0, 1, camera, center); } else if (e.isAltDown()) { ! rotate(angle, 0, 0, 1, center, camera); } else { rotate(angle, 0, 0, 1, camera, pivot); rotate(angle, 0, 0, 1, center, pivot); } glv.repaint(); --- 626,643 ---- double[] roll = view.getRoll(); double angle; if (e.getKeyCode() == KeyEvent.VK_LEFT) { ! angle = Math.PI / 18; } else { ! angle = -Math.PI / 18; } if (e.isShiftDown()) { rotate(angle, 0, 0, 1, camera, center); } else if (e.isAltDown()) { ! rotate(angle, roll[0], roll[1], roll[2], center, camera); } else { rotate(angle, 0, 0, 1, camera, pivot); rotate(angle, 0, 0, 1, center, pivot); + rotate(angle, 0, 0, 1, roll, new double[]{0, 0, 0}); } glv.repaint(); *************** *** 652,664 **** double[] roll = view.getRoll(); ! roll[0] = 0; ! roll[1] = 0; ! roll[2] = 1; ! double x; double y; double z; ! Vertex up = new Vertex("", 0, 0, 1); x = center[0] - camera[0]; y = center[1] - camera[1]; --- 649,658 ---- double[] roll = view.getRoll(); ! double[] zero = new double[]{0, 0, 0}; double x; double y; double z; ! Vertex up = new Vertex("", roll[0], roll[1], roll[2]); x = center[0] - camera[0]; y = center[1] - camera[1]; *************** *** 674,680 **** double angle; if (e.getKeyCode() == KeyEvent.VK_UP) { ! angle = Math.PI / 6; } else { ! angle = -Math.PI / 6; } if (e.isShiftDown()) { --- 668,674 ---- double angle; if (e.getKeyCode() == KeyEvent.VK_UP) { ! angle = Math.PI / 18; } else { ! angle = -Math.PI / 18; } if (e.isShiftDown()) { *************** *** 685,689 **** --- 679,685 ---- rotate(angle, x, y, z, camera, pivot); rotate(angle, x, y, z, center, pivot); + rotate(angle, x, y, z, roll, zero); } + glv.repaint(); } else { |
From: Michael L. <he...@us...> - 2005-11-24 10:31:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17584/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java PencilTool.java Log Message: Test of rotation using arrow keys in the pencil tool Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** PencilTool.java 20 Nov 2005 19:33:52 -0000 1.36 --- PencilTool.java 24 Nov 2005 10:31:22 -0000 1.37 *************** *** 18,21 **** --- 18,22 ---- import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; + import net.sourceforge.bprocessor.gl.view.View3D; import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; *************** *** 26,29 **** --- 27,31 ---- import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Geometry; + import net.sourceforge.bprocessor.model.Matrix; import java.util.Iterator; *************** *** 489,492 **** --- 491,527 ---- /** + * output values + * @param v The values + */ + private static void output(double[] v) { + System.out.println("(" + v[0] + ", " + v[1] + ", " + v[2] + ")"); + } + + /** + * Rotate + * @param angle The angle + * @param x The x + * @param y The y + * @param z The z + * @param vector The vector to rotate + * @param center The center of rotation + */ + private void rotate(double angle, double x, double y, double z, + double[] vector, double[] center) { + + double[] v = new double[4]; + + v[0] = vector[0] - center[0]; + v[1] = vector[1] - center[1]; + v[2] = vector[2] - center[2]; + v[3] = 1; + Matrix rotation = Matrix.rotation(angle, x, y, z); + v = rotation.multiply(v); + vector[0] = v[0] + center[0]; + vector[1] = v[1] + center[1]; + vector[2] = v[2] + center[2]; + } + + /** * Invoked when a key has been pressed. Lets user delete what is selected. * @param e The KeyEvent *************** *** 494,497 **** --- 529,533 ---- public void keyPressed(KeyEvent e) { boolean changed = false; + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { if (active != null) { *************** *** 583,586 **** --- 619,690 ---- } changed = true; + } else if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_RIGHT) { + View3D view = (View3D) glv.getView(); + double[] pivot = AbstractTool.selectionCenter(); + double[] camera = view.getCamera(); + double[] center = view.getCenter(); + double[] roll = view.getRoll(); + + roll[0] = 0; + roll[1] = 0; + roll[2] = 1; + + double angle; + if (e.getKeyCode() == KeyEvent.VK_LEFT) { + angle = Math.PI / 6; + } else { + angle = -Math.PI / 6; + } + if (e.isShiftDown()) { + rotate(angle, 0, 0, 1, camera, center); + } else if (e.isAltDown()) { + rotate(angle, 0, 0, 1, center, camera); + } else { + rotate(angle, 0, 0, 1, camera, pivot); + rotate(angle, 0, 0, 1, center, pivot); + } + glv.repaint(); + } else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_DOWN) { + View3D view = (View3D) glv.getView(); + double[] pivot = AbstractTool.selectionCenter(); + double[] camera = view.getCamera(); + double[] center = view.getCenter(); + double[] roll = view.getRoll(); + + roll[0] = 0; + roll[1] = 0; + roll[2] = 1; + + double x; + double y; + double z; + + Vertex up = new Vertex("", 0, 0, 1); + x = center[0] - camera[0]; + y = center[1] - camera[1]; + z = center[2] - camera[2]; + Vertex forward = new Vertex("", x, y, z); + + Vertex sidewards = up.cross(forward); + sidewards.scale(1 / sidewards.length()); + x = sidewards.getX(); + y = sidewards.getY(); + z = sidewards.getZ(); + + double angle; + if (e.getKeyCode() == KeyEvent.VK_UP) { + angle = Math.PI / 6; + } else { + angle = -Math.PI / 6; + } + if (e.isShiftDown()) { + rotate(angle, x, y, z, camera, center); + } else if (e.isAltDown()) { + rotate(angle, x, y, z, center, camera); + } else { + rotate(angle, x, y, z, camera, pivot); + rotate(angle, x, y, z, center, pivot); + } + glv.repaint(); } else { super.keyPressed(e); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** AbstractTool.java 22 Nov 2005 13:40:22 -0000 1.30 --- AbstractTool.java 24 Nov 2005 10:31:22 -0000 1.31 *************** *** 106,109 **** --- 106,132 ---- glv.repaint(false); } + + /** + * Calculate the center of the selection + * TODO calculate the average.. + * @return The center of the selection + */ + public static double[] selectionCenter() { + double[] center = new double[] {0, 0, 0}; + Iterator it = selection.iterator(); + if (it.hasNext()) { + Object o = it.next(); + if (o instanceof Surface) { + Vertex v = ((Surface)o).center(); + center = new double[] {v.getX(), v.getY(), v.getZ()}; + } else if (o instanceof Edge) { + center = ((Edge)o).center(); + } else if (o instanceof Vertex) { + Vertex v = (Vertex)o; + center = new double[] {v.getX(), v.getY(), v.getZ()}; + } + } + return center; + } /** |
From: Michael L. <he...@us...> - 2005-11-24 10:31:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17584/src/net/sourceforge/bprocessor/gl/view Modified Files: View3D.java Log Message: Test of rotation using arrow keys in the pencil tool Index: View3D.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** View3D.java 23 Nov 2005 19:04:59 -0000 1.22 --- View3D.java 24 Nov 2005 10:31:22 -0000 1.23 *************** *** 46,49 **** --- 46,73 ---- /** + * Accessor for camera + * @return The camera + */ + public double[] getCamera() { + return camera; + } + + /** + * Acessor for roll + * @return The roll + */ + public double[] getRoll() { + return roll; + } + + /** + * Accessor for center + * @return The center + */ + public double[] getCenter() { + return center; + } + + /** * The camera setup function * @param gld The GLDrawable object |
From: Michael L. <he...@us...> - 2005-11-24 10:30:54
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17470/src/net/sourceforge/bprocessor/model Added Files: Matrix.java Log Message: Added a rotation matrix --- NEW FILE: Matrix.java --- //--------------------------------------------------------------------------------- // $Id: Matrix.java,v 1.1 2005/11/24 10:30:45 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; /** * The Matrix is a 4x4 matrix, represented as * a an array of 16 double values in column-major * order. This matches the representation of * matrices in OpenGL. */ public class Matrix { /** The storage - 16 double precision floating point values in * column-major order. */ private double[] storage; /** The id matrix */ public static final double[] ID = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}; /** * Construct a rotation matrix that rotates around the (x, y, z) * vector, which is expected to have length = 1. * the constructed matrix has the following layout: * x^2(1-c)+c xy(1-c)-zs xz(1-c)+ys 0 * yx(1-c)+zs y^2(1-c)+c yz(1-c)-xs 0 * xz(1-c)-ys yz(1-c)+xs z^2(1-c)+c 0 * 0 0 0 1 * where c = cos(angle) and s = sin(angle). * @param angle The angle to rotate * @param x The x * @param y The y * @param z The z * @return The Matrix */ public static Matrix rotation(double angle, double x, double y, double z) { double s = Math.sin(angle); double c = Math.cos(angle); double[] v = new double[16]; v[0] = x * x * (1 - c) + c; v[1] = y * x * (1 - c) + z * s; v[2] = x * z * (1 - c) - y * s; v[3] = 0; v[4] = x * y * (1 - c) - z * s; v[5] = y * y * (1 - c) + c; v[6] = y * z * (1 - c) + x * s; v[7] = 0; v[8] = x * z * (1 - c) + y * s; v[9] = y * z * (1 - c) - x * s; v[10] = z * z * (1 - c) + c; v[11] = 0; v[12] = 0; v[13] = 0; v[14] = 0; v[15] = 1; return new Matrix(v); } /** * Construct a matrix with specified values * @param values The values in column-major order */ public Matrix(double[] values) { super(); this.storage = values; } /** * Construct a default matrix - the ID */ public Matrix() { this((double[]) ID.clone()); } /** * Multiply a Matrix to a vector: Mx * @param vector The vector * @return A vector multiplied by this Matrix */ public double[] multiply(double[] vector) { double[] result = new double[4]; result[0] = storage[0] * vector[0] + storage[4] * vector[1] + storage[8] * vector[2] + storage[12] * vector[3]; result[1] = storage[1] * vector[0] + storage[5] * vector[1] + storage[9] * vector[2] + storage[13] * vector[3]; result[2] = storage[2] * vector[0] + storage[6] * vector[1] + storage[10] * vector[2] + storage[14] * vector[3]; result[3] = storage[3] * vector[0] + storage[7] * vector[1] + storage[11] * vector[2] + storage[15] * vector[3]; return result; } } |
From: Nordholt <nor...@us...> - 2005-11-23 19:06:39
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26512 Modified Files: GUI.java Log Message: added method for adding to the menus Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GUI.java 20 Nov 2005 19:32:37 -0000 1.12 --- GUI.java 23 Nov 2005 19:06:31 -0000 1.13 *************** *** 280,283 **** --- 280,292 ---- menu.registerMenu(help); } + + /** + * Adds a menu to the menu bar. + * @param extraMenu the menu. + */ + public void addMenu(JMenu extraMenu) { + Menu menu = Menu.getInstance(); + menu.registerMenu(extraMenu); + } /** |
From: Nordholt <nor...@us...> - 2005-11-23 19:05:22
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25954 Modified Files: View.java Log Message: added support for customizable colors Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** View.java 17 Nov 2005 18:14:00 -0000 1.21 --- View.java 23 Nov 2005 19:05:14 -0000 1.22 *************** *** 42,46 **** /** the background color */ ! public static final float[] BACKGROUND_COLOR = new float[] {1.0f, 1.0f, 1.0f}; /** the std line color*/ --- 42,46 ---- /** the background color */ ! public static final float[] BACKGROUND_COLOR = new float[] {1.0f, 1.0f, 1.0f, 0.0f}; /** the std line color*/ *************** *** 278,283 **** /** ! * De selects the currently selected label. */ public void deSelectLabel(); } --- 278,299 ---- /** ! * Deselects the currently selected label. */ public void deSelectLabel(); + + /** + * Sets the background color + * @param color the color. + */ + public void setBGColor(float[] color); + /** + * Sets the line color + * @param color the color. + */ + public void setLineColor(float[] color); + /** + * Sets the grid color + * @param color the color. + */ + public void setGridColor(float[] color); } |
From: Nordholt <nor...@us...> - 2005-11-23 19:05:07
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25867 Modified Files: View3D.java Log Message: added support for customizable colors Index: View3D.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** View3D.java 18 Nov 2005 01:27:56 -0000 1.21 --- View3D.java 23 Nov 2005 19:04:59 -0000 1.22 *************** *** 349,353 **** size /= aspect; } ! gl.glColor4fv(GRID_COLOR); gl.glBegin(GL.GL_LINES); size /= 2; --- 349,353 ---- size /= aspect; } ! gl.glColor4fv(gridColor); gl.glBegin(GL.GL_LINES); size /= 2; |
From: Nordholt <nor...@us...> - 2005-11-23 19:04:47
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25725 Modified Files: AbstractView.java Log Message: added support for customizable colors Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** AbstractView.java 20 Nov 2005 19:33:52 -0000 1.59 --- AbstractView.java 23 Nov 2005 19:04:38 -0000 1.60 *************** *** 84,87 **** --- 84,96 ---- protected static Vertex currentVertex = null; + /** The current background color */ + protected static float[] bgColor; + + /** The current line color */ + protected static float[] lineColor; + + /** The current grid color */ + protected static float[] gridColor; + /** The target */ *************** *** 225,228 **** --- 234,240 ---- this.glv = glv; clippingPlanes = new ArrayList(); + bgColor = BACKGROUND_COLOR; + lineColor = STD_LINE_COLOR; + gridColor = GRID_COLOR; } *************** *** 243,247 **** AbstractView.aspect = AbstractView.width / AbstractView.height; ! gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f); gl.glViewport(0, 0, (int)width, (int)height); gl.glLineStipple(4, (short)0xAAAA); --- 255,259 ---- AbstractView.aspect = AbstractView.width / AbstractView.height; ! gl.glClearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]); gl.glViewport(0, 0, (int)width, (int)height); gl.glLineStipple(4, (short)0xAAAA); *************** *** 270,273 **** --- 282,286 ---- */ public void display(GLDrawable gld) { + gl.glClearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]); Plane xy = new Plane(0, 0, 1, 0); gl = gld.getGL(); *************** *** 317,321 **** } ! gl.glColor3fv(STD_LINE_COLOR); gl.glLineWidth(1.0f); drawAll(gld); --- 330,334 ---- } ! gl.glColor3fv(lineColor); gl.glLineWidth(1.0f); drawAll(gld); *************** *** 662,666 **** if (doDrawEdges) { gl.glLineWidth(1.0f); ! gl.glColor3fv(STD_LINE_COLOR); // draw all the edges in the model Iterator eit = edges.iterator(); --- 675,679 ---- if (doDrawEdges) { gl.glLineWidth(1.0f); ! gl.glColor3fv(lineColor); // draw all the edges in the model Iterator eit = edges.iterator(); *************** *** 673,682 **** // Draw any Vertex that are not part of an edge { ! gl.glColor3fv(STD_LINE_COLOR); Iterator it = vertices.iterator(); while (it.hasNext()) { Vertex v = (Vertex)it.next(); if (v.getEdges().isEmpty()) { ! gl.glColor3fv(STD_LINE_COLOR); gl.glPointSize(5.0f); gl.glBegin(GL.GL_POINTS); --- 686,695 ---- // Draw any Vertex that are not part of an edge { ! gl.glColor3fv(lineColor); Iterator it = vertices.iterator(); while (it.hasNext()) { Vertex v = (Vertex)it.next(); if (v.getEdges().isEmpty()) { ! gl.glColor3fv(lineColor); gl.glPointSize(5.0f); gl.glBegin(GL.GL_POINTS); *************** *** 751,755 **** gl.glColor3fv(Z_AXIS_COLOR); } else { ! gl.glColor3fv(STD_LINE_COLOR); } gl.glBegin(GL.GL_LINES); --- 764,768 ---- gl.glColor3fv(Z_AXIS_COLOR); } else { ! gl.glColor3fv(lineColor); } gl.glBegin(GL.GL_LINES); *************** *** 801,805 **** if (selectMode == VERTICES || selectMode == ALL) { Iterator it = vertices.iterator(); ! gl.glColor3fv(STD_LINE_COLOR); while (it.hasNext()) { Vertex v = (Vertex)it.next(); --- 814,818 ---- if (selectMode == VERTICES || selectMode == ALL) { Iterator it = vertices.iterator(); ! gl.glColor3fv(lineColor); while (it.hasNext()) { Vertex v = (Vertex)it.next(); *************** *** 811,815 **** if (selectMode == EDGES || selectMode == ALL) { Iterator it = edges.iterator(); ! gl.glColor3fv(STD_LINE_COLOR); while (it.hasNext()) { Edge e = (Edge)it.next(); --- 824,828 ---- if (selectMode == EDGES || selectMode == ALL) { Iterator it = edges.iterator(); ! gl.glColor3fv(lineColor); while (it.hasNext()) { Edge e = (Edge)it.next(); *************** *** 1064,1068 **** Iterator it = edges.iterator(); ! gl.glColor3fv(STD_LINE_COLOR); while (it.hasNext()) { Edge e = (Edge)it.next(); --- 1077,1081 ---- Iterator it = edges.iterator(); ! gl.glColor3fv(lineColor); while (it.hasNext()) { Edge e = (Edge)it.next(); *************** *** 1624,1626 **** --- 1637,1662 ---- return rayDir.dot(normal) < 0; } + + /** + * Sets the background color + * @param color the color. + */ + public void setBGColor(float[] color) { + bgColor = color; + } + /** + * Sets the line color + * @param color the color. + */ + public void setLineColor(float[] color) { + lineColor = color; + } + + /** + * Sets the grid color + * @param color the color. + */ + public void setGridColor(float[] color) { + gridColor = color; + } } |
From: Nordholt <nor...@us...> - 2005-11-23 19:03:34
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25297 Modified Files: GLView.java Log Message: added a color customizing menu Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** GLView.java 21 Nov 2005 09:50:51 -0000 1.25 --- GLView.java 23 Nov 2005 19:03:26 -0000 1.26 *************** *** 31,38 **** --- 31,41 ---- import java.awt.event.MouseEvent; import java.awt.event.MouseListener; + import java.awt.event.ActionListener; import javax.swing.JTextField; import javax.swing.JPanel; import javax.swing.JLabel; + import javax.swing.JMenu; + import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; *************** *** 91,94 **** --- 94,116 ---- glc.addMouseListener(this); GUI.getInstance().registerPanel(jp, GUI.SPLIT_MIDDLE); + + JMenu colorMenu = new JMenu("GL Colors"); + ActionListener colorMenuListener = new GLColorMenuActionListener(view); + JMenuItem gridItem = new JMenuItem("Grid Color"); + gridItem.addActionListener(colorMenuListener); + JMenuItem lineItem = new JMenuItem("Line Color"); + lineItem.addActionListener(colorMenuListener); + JMenuItem bgItem = new JMenuItem("Background Color"); + bgItem.addActionListener(colorMenuListener); + JMenuItem defaultItem = new JMenuItem("Default"); + defaultItem.addActionListener(colorMenuListener); + + colorMenu.add(gridItem); + colorMenu.add(lineItem); + colorMenu.add(bgItem); + colorMenu.add(defaultItem); + + GUI.getInstance().addMenu(colorMenu); + glc.setAutoSwapBufferMode(false); repaint(); |
From: Nordholt <nor...@us...> - 2005-11-23 19:02:19
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24719 Added Files: GLColorMenuActionListener.java Log Message: The listener for the color menu --- NEW FILE: GLColorMenuActionListener.java --- //--------------------------------------------------------------------------------- // $Id: GLColorMenuActionListener.java,v 1.1 2005/11/23 19:02:10 nordholt Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gui.GUI; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.Color; import javax.swing.JColorChooser; import org.apache.log4j.Logger; /** * Listener for the GL Color menu. */ public class GLColorMenuActionListener implements ActionListener { /** * The logger */ private static Logger log = Logger.getLogger(GLColorMenuActionListener.class); /** * The view */ private View view; /** * */ /** * Creates a new listener. * @param view the view. */ public GLColorMenuActionListener (View view) { this.view = view; } /** * Invoked when an action is performed * @param e The action event */ public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("Grid Color")) { Color newColor = JColorChooser.showDialog(GUI.getInstance(), "Grid Color", Color.white); view.setGridColor(newColor.getRGBComponents(null)); } else if (e.getActionCommand().equals("Line Color")) { Color newColor = JColorChooser.showDialog(GUI.getInstance(), "Line Color", Color.white); view.setLineColor(newColor.getRGBComponents(null)); } else if (e.getActionCommand().equals("Background Color")) { Color newColor = JColorChooser.showDialog(GUI.getInstance(), "Background Color", Color.white); view.setBGColor(newColor.getRGBComponents(null)); } else if (e.getActionCommand().equals("Default")) { view.setBGColor(View.BACKGROUND_COLOR); view.setBGColor(View.GRID_COLOR); view.setBGColor(View.STD_LINE_COLOR); } } } |
From: Nordholt <nor...@us...> - 2005-11-23 16:55:24
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21994 Modified Files: Surface.java Log Message: changed contained check to use new version of the surrounds method, using plane precission of 1 Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** Surface.java 23 Nov 2005 13:21:50 -0000 1.48 --- Surface.java 23 Nov 2005 16:55:04 -0000 1.49 *************** *** 469,473 **** //this can not happen so here we move the inner surface back { - log.info("contained check fejlede"); List vertices = getVertices(); Vertex v0 = (Vertex) vertices.get(0); --- 469,472 ---- *************** *** 511,515 **** boolean contained = true; while (vertIt.hasNext() && contained) { ! contained = surf.surrounds((Vertex)vertIt.next()); } return contained; --- 510,514 ---- boolean contained = true; while (vertIt.hasNext() && contained) { ! contained = surf.surrounds((Vertex)vertIt.next(), 1); } return contained; *************** *** 887,891 **** return null; } ! /** * Return the hash code of the object --- 886,890 ---- return null; } ! /** * Return the hash code of the object |
From: Nordholt <nor...@us...> - 2005-11-23 16:52:05
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21272 Modified Files: ExtrusionTool.java Log Message: simplified moving the extrusion by using the surface move method. Improved extruding into other surfaces however still only works when extruding into surfaces that are parrallel with the original surface Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ExtrusionTool.java 23 Nov 2005 13:18:23 -0000 1.30 --- ExtrusionTool.java 23 Nov 2005 16:51:56 -0000 1.31 *************** *** 69,72 **** --- 69,75 ---- private String number; + /** Wherther we are still allowed to drag the extrusion */ + private boolean dragAllowed; + /** * The Constructor *************** *** 88,104 **** return; } ! if (target instanceof Surface) { ! Surface selectedSurface = (Surface)target; ! if (dragSurface == null) { ! dragSurface = createExtension(selectedSurface); ! } else { ! Vertex normal = dragSurface.normal(); ! normal.scale(1 / normal.length()); ! 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); ! moveDelta(normDotDelta); } } --- 91,109 ---- return; } ! if (dragAllowed) { ! if (target instanceof Surface) { ! Surface selectedSurface = (Surface)target; ! if (dragSurface == null) { ! dragSurface = createExtension(selectedSurface); ! } else { ! Vertex normal = dragSurface.normal(); ! normal.scale(1 / normal.length()); ! 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); ! moveDelta(normDotDelta); ! } } } *************** *** 115,165 **** normal.scale(1 / normal.length()); normal.scale(delta / (normal.length() * normal.length())); ! List l = dragSurface.getVertices(); ! //moving the dragged surface along its normal vector ! for (int count = 0; l != null && count < l.size() - 1; count++) { ! Vertex v = (Vertex)l.get(count); ! updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! 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 = innerSurf.getVertices(); ! for (int count = 0; verticies != null && count < verticies.size() - 1; count++) { ! Vertex v = (Vertex)verticies.get(count); ! updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); ! } ! } ! } Surface inSurface = inOtherSurface(dragSurface); if (inSurface != null) { ! List list = dragSurface.getVertices(); ! Iterator listIt = list.iterator(); ! Vertex to = null; ! Vertex from = null; ! Vertex first = null; ! List edges = new LinkedList(); ! if (listIt.hasNext()) { ! from = (Vertex)listIt.next(); ! first = from; ! } ! while (listIt.hasNext()) { ! to = (Vertex)listIt.next(); ! edges.add(createEdge(from, to)); ! from = to; ! } ! if (from != null) { ! edges.add(createEdge(from, first)); ! } ! Surface hole = createSurface(edges); ! inSurface.addHole(hole); ! dragSurface = createExtension(dragSurface); ! spaceAssignment(); } if (extrusion != null) { --- 120,128 ---- normal.scale(1 / normal.length()); normal.scale(delta / (normal.length() * normal.length())); ! dragSurface.move(normal.getX(), normal.getY(), normal.getZ()); Surface inSurface = inOtherSurface(dragSurface); if (inSurface != null) { ! inSurface.addHole(dragSurface); ! endExtrusion(); } if (extrusion != null) { *************** *** 228,231 **** --- 191,204 ---- dragplane = selectedSurface.plane().orthogonalPlane(ray); } + dragAllowed = true; + } + + /** + * Does the work when ending the current extrusion + */ + private void endExtrusion() { + //holeDetection(); + spaceAssignment(); + dragAllowed = false; } *************** *** 236,241 **** protected void released(MouseEvent e) { super.released(e); ! //holeDetection(); ! spaceAssignment(); } --- 209,213 ---- protected void released(MouseEvent e) { super.released(e); ! endExtrusion(); } |
From: Nordholt <nor...@us...> - 2005-11-23 13:22:02
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2669/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: new surrounds method Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** Surface.java 18 Nov 2005 12:15:44 -0000 1.47 --- Surface.java 23 Nov 2005 13:21:50 -0000 1.48 *************** *** 806,815 **** return edges.contains(e); } /** * Tells whether or not a Vertex is contained inside the surface. * @param v the vertex * @return boolean whether or not the vertex is surrounded by the surface. */ ! public boolean surrounds(Vertex v) { CoordinateSystem cs = this.coordinateSystem(); Vertex lv = cs.translate(v); --- 806,818 ---- return edges.contains(e); } + /** * Tells whether or not a Vertex is contained inside the surface. * @param v the vertex + * @param planePrecision the precision to wich the vertex must be in the same + * plane as this surface. * @return boolean whether or not the vertex is surrounded by the surface. */ ! public boolean surrounds(Vertex v, double planePrecision) { CoordinateSystem cs = this.coordinateSystem(); Vertex lv = cs.translate(v); *************** *** 818,822 **** this surface */ ! if (lv.getZ() > 0.00001) { return false; } else { --- 821,826 ---- this surface */ ! ! if (lv.getZ() > planePrecision || -lv.getZ() > planePrecision) { return false; } else { *************** *** 859,862 **** --- 863,875 ---- } } + + /** + * Tells whether or not a Vertex is contained inside the surface. + * @param v the vertex + * @return boolean whether or not the vertex is surrounded by the surface. + */ + public boolean surrounds(Vertex v) { + return surrounds(v, 0.00001); + } /** * Find the intersection point of an endge with this Surface. |
From: Nordholt <nor...@us...> - 2005-11-23 13:18:33
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1594/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrusionTool.java Log Message: extrusion through surfaces makes holes in the surfaces. still doesnt work completely in some situations Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ExtrusionTool.java 18 Nov 2005 12:32:05 -0000 1.29 --- ExtrusionTool.java 23 Nov 2005 13:18:23 -0000 1.30 *************** *** 41,45 **** /** The logger */ private static Logger log = Logger.getLogger(ExtrusionTool.class); ! /** The new surface to drag */ private static Surface dragSurface = null; --- 41,45 ---- /** The logger */ private static Logger log = Logger.getLogger(ExtrusionTool.class); ! /** The new surface to drag */ private static Surface dragSurface = null; *************** *** 53,57 **** /** The previous y-coordinate */ private double prevY; ! /** The extrusion edge */ private Edge extrusion; --- 53,57 ---- /** The previous y-coordinate */ private double prevY; ! /** The extrusion edge */ private Edge extrusion; *************** *** 68,72 **** /** The length typed in for length of the extrusion*/ private String number; ! /** * The Constructor --- 68,72 ---- /** The length typed in for length of the extrusion*/ private String number; ! /** * The Constructor *************** *** 84,88 **** //have to use getModifiersEx() getButton() gives wrong results if ((e.getModifiersEx() & ! MouseEvent.BUTTON3_DOWN_MASK) == MouseEvent.BUTTON3_DOWN_MASK) { return; --- 84,88 ---- //have to use getModifiersEx() getButton() gives wrong results if ((e.getModifiersEx() & ! MouseEvent.BUTTON3_DOWN_MASK) == MouseEvent.BUTTON3_DOWN_MASK) { return; *************** *** 120,127 **** Vertex v = (Vertex)l.get(count); updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); } ! //also moving any inner surfaces Set innerSurfaces = dragSurface.getInnerSurfaces(); if (innerSurfaces != null) { --- 120,127 ---- Vertex v = (Vertex)l.get(count); updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); } ! //also moving any inner surfaces Set innerSurfaces = dragSurface.getInnerSurfaces(); if (innerSurfaces != null) { *************** *** 133,141 **** Vertex v = (Vertex)verticies.get(count); updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); } } } if (extrusion != null) { glv.setLength(extrusion.getLength()); --- 133,166 ---- Vertex v = (Vertex)verticies.get(count); updateVertex(v, new double[] {v.getX() + normal.getX(), ! v.getY() + normal.getY(), ! v.getZ() + normal.getZ()}); } } } + Surface inSurface = inOtherSurface(dragSurface); + if (inSurface != null) { + List list = dragSurface.getVertices(); + Iterator listIt = list.iterator(); + Vertex to = null; + Vertex from = null; + Vertex first = null; + List edges = new LinkedList(); + if (listIt.hasNext()) { + from = (Vertex)listIt.next(); + first = from; + } + while (listIt.hasNext()) { + to = (Vertex)listIt.next(); + edges.add(createEdge(from, to)); + from = to; + } + if (from != null) { + edges.add(createEdge(from, first)); + } + Surface hole = createSurface(edges); + inSurface.addHole(hole); + dragSurface = createExtension(dragSurface); + spaceAssignment(); + } if (extrusion != null) { glv.setLength(extrusion.getLength()); *************** *** 143,146 **** --- 168,203 ---- } } + + /** + * Tells if a surface is inside any other surface. + * @param drag the surface + * @return a surface the dragsurface is now inside, + * null if none such exists. + */ + private Surface inOtherSurface(Surface drag) { + boolean inSide = false; + Set surfaces = Project.getInstance().getSurfaces(); + Iterator it = surfaces.iterator(); + + Surface surface = null; + while (it.hasNext() && !inSide) { + surface = (Surface)it.next(); + if (!surface.equals(drag) && !surface.equals(extrudeSurface)) { + Iterator vertIt = drag.getVertices().iterator(); + if (vertIt.hasNext()) { + inSide = true; + } + while (vertIt.hasNext() && inSide) { + Vertex vert = (Vertex)vertIt.next(); + inSide = surface.surrounds(vert, 1); + } + } + } + if (inSide) { + return surface; + } else { + return null; + } + } /** * Invoked when a mouse button has been pressed on a component. *************** *** 158,162 **** glv.setLength(0); super.pressed(e); ! if (target instanceof Surface) { Surface selectedSurface = (Surface)target; --- 215,219 ---- glv.setLength(0); super.pressed(e); ! if (target instanceof Surface) { Surface selectedSurface = (Surface)target; *************** *** 227,231 **** while (sideEdgeIt.hasNext() && hole) { Edge edge = (Edge)sideEdgeIt.next(); ! Vertex vertex = surface.intersection(edge); if (vertex == null) { hole = false; --- 284,288 ---- while (sideEdgeIt.hasNext() && hole) { Edge edge = (Edge)sideEdgeIt.next(); ! Vertex vertex = surface.intersection(edge); if (vertex == null) { hole = false; *************** *** 251,265 **** } /* ! Debug code ! Iterator it = edgeToSplit.keySet().iterator(); ! while (it.hasNext()) { ! Edge edge = (Edge)it.next(); ! log.info("To: " + edge.getTo()); ! Iterator it2 = ((LinkedList)edgeToSplit.get(edge)).iterator(); ! while (it2.hasNext()) { ! log.info((Vertex)it2.next()); ! } ! } ! */ breakExtension(surfaceToInnerPoints, edgeToSplit, splitToEdge); } --- 308,322 ---- } /* ! Debug code ! Iterator it = edgeToSplit.keySet().iterator(); ! while (it.hasNext()) { ! Edge edge = (Edge)it.next(); ! log.info("To: " + edge.getTo()); ! Iterator it2 = ((LinkedList)edgeToSplit.get(edge)).iterator(); ! while (it2.hasNext()) { ! log.info((Vertex)it2.next()); ! } ! } ! */ breakExtension(surfaceToInnerPoints, edgeToSplit, splitToEdge); } *************** *** 314,318 **** return distance1 < distance2; } ! /** --- 371,375 ---- return distance1 < distance2; } ! /** *************** *** 498,506 **** if (previousEdge == null) { Vertex newTo = createVertex(new double[] {current.getFrom().getX(), ! current.getFrom().getY(), ! current.getFrom().getZ()}); Vertex newFrom = createVertex(new double[] {current.getTo().getX(), ! current.getTo().getY(), ! current.getTo().getZ()}); Edge newE = createEdge(newFrom, newTo); Edge ntofrom = createEdge(newTo, current.getFrom()); --- 555,563 ---- if (previousEdge == null) { Vertex newTo = createVertex(new double[] {current.getFrom().getX(), ! current.getFrom().getY(), ! current.getFrom().getZ()}); Vertex newFrom = createVertex(new double[] {current.getTo().getX(), ! current.getTo().getY(), ! current.getTo().getZ()}); Edge newE = createEdge(newFrom, newTo); Edge ntofrom = createEdge(newTo, current.getFrom()); *************** *** 520,524 **** if (times == edges.size() - 1 && ((first.getTo() == current.getTo()) || ! (first.getTo() == current.getFrom()))) { Edge newE = createEdge(first.getFrom(), previousEdge.getTo()); newEdges.add(current); --- 577,581 ---- if (times == edges.size() - 1 && ((first.getTo() == current.getTo()) || ! (first.getTo() == current.getFrom()))) { Edge newE = createEdge(first.getFrom(), previousEdge.getTo()); newEdges.add(current); *************** *** 530,535 **** Vertex c = current.otherVertex(previousEdge.otherVertex(previousVertex)); Vertex newFrom = createVertex(new double[] {c.getX(), ! c.getY(), ! c.getZ()}); Edge newE = createEdge(newFrom, previousVertex); Edge tonfrom = createEdge(c, newFrom); --- 587,592 ---- Vertex c = current.otherVertex(previousEdge.otherVertex(previousVertex)); Vertex newFrom = createVertex(new double[] {c.getX(), ! c.getY(), ! c.getZ()}); Edge newE = createEdge(newFrom, previousVertex); Edge tonfrom = createEdge(c, newFrom); *************** *** 576,590 **** private Surface createExtension(Surface selectedSurface) { extrudeSurface = selectedSurface; ! LinkedList extensions = extendSurface(selectedSurface); Surface top = (Surface)extensions.getFirst(); extensions.addLast(extrudeSurface); /* ! Note the first surface of the extensions lists is the top of the ! hole extension and the last surface is the bottom. This is used ! when assigning spaces to the surfaces. ! */ extrudedSurfaces = extensions; ! Set innerSurfaces = selectedSurface.getInnerSurfaces(); innerExSurfs = new HashSet(); --- 633,647 ---- private Surface createExtension(Surface selectedSurface) { extrudeSurface = selectedSurface; ! LinkedList extensions = extendSurface(selectedSurface); Surface top = (Surface)extensions.getFirst(); extensions.addLast(extrudeSurface); /* ! Note the first surface of the extensions lists is the top of the ! hole extension and the last surface is the bottom. This is used ! when assigning spaces to the surfaces. ! */ extrudedSurfaces = extensions; ! Set innerSurfaces = selectedSurface.getInnerSurfaces(); innerExSurfs = new HashSet(); *************** *** 597,604 **** extensions.addLast(innerSurf); /* ! Note the first surface of the extensions lists is the top of the ! hole-extension and the last surface is the bottom. This is used ! when assigning spaces to the surfaces. ! */ innerExSurfs.add(extensions); top.addHole(newInnerSurf); --- 654,661 ---- extensions.addLast(innerSurf); /* ! Note the first surface of the extensions lists is the top of the ! hole-extension and the last surface is the bottom. This is used ! when assigning spaces to the surfaces. ! */ innerExSurfs.add(extensions); top.addHole(newInnerSurf); *************** *** 615,620 **** public void keyPressed(KeyEvent e) { /*a length can only be typed in if some surface is selected ! for extrusion, and if the "number"-variable has been initialised ! */ super.keyPressed(e); if (dragSurface != null && number != null) { --- 672,677 ---- public void keyPressed(KeyEvent e) { /*a length can only be typed in if some surface is selected ! for extrusion, and if the "number"-variable has been initialised ! */ super.keyPressed(e); if (dragSurface != null && number != null) { |
From: Michael L. <he...@us...> - 2005-11-22 16:18:23
|
Update of /cvsroot/bprocessor/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21427 Modified Files: build.xml Log Message: changed version to M2a Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/build/build.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** build.xml 18 Nov 2005 16:26:27 -0000 1.8 --- build.xml 22 Nov 2005 16:18:04 -0000 1.9 *************** *** 3,7 **** <target name="init"> <property name="project" value="bprocessor"/> ! <property name="version" value="M2"/> <property name="script.dir" value="${basedir}/bin"/> --- 3,7 ---- <target name="init"> <property name="project" value="bprocessor"/> ! <property name="version" value="M2a"/> <property name="script.dir" value="${basedir}/bin"/> |
From: Michael L. <he...@us...> - 2005-11-22 16:16:30
|
Update of /cvsroot/bprocessor/build/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21056/doc Modified Files: Changelog Log Message: Added a few notes Index: Changelog =================================================================== RCS file: /cvsroot/bprocessor/build/doc/Changelog,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Changelog 18 Nov 2005 01:49:44 -0000 1.4 --- Changelog 22 Nov 2005 16:16:13 -0000 1.5 *************** *** 7,16 **** - Replaced the attribute view - Added cursors for the different tools ! - Model: - far better selection of edges and vertexes ! - algorithms for splitting edges and spaces ! - GL: --- 7,15 ---- - Replaced the attribute view - Added cursors for the different tools ! - Support for assigning spaces to surfaces Model: - far better selection of edges and vertexes ! - algorithms for subdividing edges and surfaces GL: *************** *** 20,25 **** - Clipping planes - length input is added for extrusion ! - guidence lines ! - 2005/09/23: Release M1 --- 19,23 ---- - Clipping planes - length input is added for extrusion ! - guidance lines 2005/09/23: Release M1 |
From: Michael L. <he...@us...> - 2005-11-22 13:40:33
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11542/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java ToolFactory.java Log Message: - Changed cursor to 32x32, which is only supported size on windows. - Fixed error when using escape while drawing with pencil Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ToolFactory.java 18 Nov 2005 01:27:56 -0000 1.14 --- ToolFactory.java 22 Nov 2005 13:40:22 -0000 1.15 *************** *** 68,72 **** Cursor pencilcursor = Toolkit.getDefaultToolkit().createCustomCursor(pencilimage, new Point(7, 8), "Pencil"); ! url = cl.getResource("Biconrotcam.gif"); Image rotationImage = Toolkit.getDefaultToolkit().getImage(url); Cursor rotationCursor = --- 68,72 ---- Cursor pencilcursor = Toolkit.getDefaultToolkit().createCustomCursor(pencilimage, new Point(7, 8), "Pencil"); ! url = cl.getResource("Bcursorrotcam.gif"); Image rotationImage = Toolkit.getDefaultToolkit().getImage(url); Cursor rotationCursor = Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** AbstractTool.java 18 Nov 2005 12:31:26 -0000 1.29 --- AbstractTool.java 22 Nov 2005 13:40:22 -0000 1.30 *************** *** 447,454 **** */ protected void deleteEdge(Edge edge) { ! Set surfaces = edge.getSurfaces(); ! if (surfaces.size() < 1) { ! removeEdge(edge); ! glv.repaint(); deleteVertex(edge.getTo()); deleteVertex(edge.getFrom()); --- 447,459 ---- */ protected void deleteEdge(Edge edge) { ! if (edge.getId() != null) { ! Set surfaces = edge.getSurfaces(); ! if (surfaces.size() < 1) { ! removeEdge(edge); ! glv.repaint(); ! deleteVertex(edge.getTo()); ! deleteVertex(edge.getFrom()); ! } ! } else { deleteVertex(edge.getTo()); deleteVertex(edge.getFrom()); *************** *** 461,468 **** */ protected void deleteVertex(Vertex vertex) { ! Set edges = vertex.getEdges(); ! if (edges.size() < 1) { ! removeVertex(vertex); ! glv.repaint(); } } --- 466,475 ---- */ protected void deleteVertex(Vertex vertex) { ! if (vertex.getId() != null) { ! Set edges = vertex.getEdges(); ! if (edges.size() < 1) { ! removeVertex(vertex); ! glv.repaint(); ! } } } |
From: Michael L. <he...@us...> - 2005-11-22 13:40:33
|
Update of /cvsroot/bprocessor/gl/src/gfx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11542/src/gfx Modified Files: Bcursorpen2.gif Bcursorpen1.gif Added Files: Bcursorrotcam.gif Log Message: - Changed cursor to 32x32, which is only supported size on windows. - Fixed error when using escape while drawing with pencil Index: Bcursorpen1.gif =================================================================== RCS file: /cvsroot/bprocessor/gl/src/gfx/Bcursorpen1.gif,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvstvt6We and /tmp/cvsUyeoNi differ --- NEW FILE: Bcursorrotcam.gif --- (This appears to be a binary file; contents omitted.) Index: Bcursorpen2.gif =================================================================== RCS file: /cvsroot/bprocessor/gl/src/gfx/Bcursorpen2.gif,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsY8G5lh and /tmp/cvseZTiil differ |
From: Nikolaj B. <nbr...@us...> - 2005-11-21 09:53:50
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv649/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: Added notification to update functionalspace method Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Project.java 18 Nov 2005 16:24:11 -0000 1.6 --- Project.java 21 Nov 2005 09:53:41 -0000 1.7 *************** *** 297,300 **** --- 297,302 ---- public void update(FunctionalSpace f) { DatabaseFacade.getInstance().update(f); + Notification n = new Notification(Notification.FUNCTIONAL_SPACE_MODIFIED, f.getId()); + Notifier.getInstance().sendNotification(n); } |