bprocessor-commit Mailing List for B-processor (Page 46)
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...> - 2007-10-26 09:10:51
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5401/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: Made some space menu items condional on a "CHECKS" flag Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** PopupMenu.java 24 Oct 2007 06:48:28 -0000 1.56 --- PopupMenu.java 26 Oct 2007 09:10:50 -0000 1.57 *************** *** 56,59 **** --- 56,61 ---- private static Logger log = Logger.getLogger(PopupMenu.class); + private static final boolean CHECKS = false; + /** * make a popup menu for a surface *************** *** 227,281 **** pm.addSeparator(); ! ! if (s != null) { ! AbstractAction copy = new CollectionMenuAction(s, "Duplicate") { ! public void actionPerformed(ActionEvent arg0) { ! if (col != null) { ! Iterator iter = col.iterator(); ! while (iter.hasNext()) { ! Space space = (Space)iter.next(); ! Space spaceCopy = space.copy(); ! Selection.primary().set(spaceCopy); ! Project.getInstance().checkpoint(); ! } } } ! }; ! pm.add(copy); ! AbstractAction instantiate = new CollectionMenuAction(s, "Instantiate") { ! public void actionPerformed(ActionEvent arg0) { ! if (col != null) { ! /*FIXME better if there were made a union if more than one and a instance of it */ ! Iterator iter = col.iterator(); ! while (iter.hasNext()) { ! Space space = (Space)iter.next(); ! Space instance = new Space("Instance of " + space.getName(), ! Space.CONSTRUCTION, space.getLevel(), false); ! instance.setProto(space); ! space.getOwner().add(instance); ! } ! Project.getInstance().changed(Project.getInstance()); ! Project.getInstance().checkpoint(); } } ! }; ! pm.add(instantiate); ! if (s.size() == 1) { ! // Some options do only apply to one space ! Space sp = (Space)s.iterator().next(); ! if (((Space)s.iterator().next()).getLevel() != Space.PART_LEVEL) { ! AbstractAction edit = new SpaceMenuAction(sp, "Edit") { ! public void actionPerformed(ActionEvent arg0) { ! Selection.primary().clear(); ! Project p = Project.getInstance(); ! space.edit(); ! //FIXME: changed is also called in the edit-method on space ! //It is properly only needed once. ! p.changed(p); ! } ! }; ! pm.add(edit); ! } AbstractAction envelope = new SpaceMenuAction(sp, "Compute Envelope") { public void actionPerformed(ActionEvent arg0) { --- 229,284 ---- pm.addSeparator(); ! ! AbstractAction copy = new CollectionMenuAction(s, "Duplicate") { ! public void actionPerformed(ActionEvent arg0) { ! if (col != null) { ! Iterator iter = col.iterator(); ! while (iter.hasNext()) { ! Space space = (Space)iter.next(); ! Space spaceCopy = space.copy(); ! Selection.primary().set(spaceCopy); ! Project.getInstance().checkpoint(); } } ! } ! }; ! pm.add(copy); ! AbstractAction instantiate = new CollectionMenuAction(s, "Instantiate") { ! public void actionPerformed(ActionEvent arg0) { ! if (col != null) { ! /*FIXME better if there were made a union if more than one and a instance of it */ ! Iterator iter = col.iterator(); ! while (iter.hasNext()) { ! Space space = (Space)iter.next(); ! Space instance = new Space("Instance of " + space.getName(), ! Space.CONSTRUCTION, space.getLevel(), false); ! instance.setProto(space); ! space.getOwner().add(instance); } + Project.getInstance().changed(Project.getInstance()); + Project.getInstance().checkpoint(); } ! } ! }; ! pm.add(instantiate); ! if (s.size() == 1) { ! // Some options do only apply to one space ! Space sp = (Space)s.iterator().next(); ! if (((Space)s.iterator().next()).getLevel() != Space.PART_LEVEL) { ! AbstractAction edit = new SpaceMenuAction(sp, "Edit") { ! public void actionPerformed(ActionEvent arg0) { ! Selection.primary().clear(); ! Project p = Project.getInstance(); ! space.edit(); ! //FIXME: changed is also called in the edit-method on space ! //It is properly only needed once. ! p.changed(p); ! } ! }; ! pm.add(edit); ! } ! ! if (CHECKS) { AbstractAction envelope = new SpaceMenuAction(sp, "Compute Envelope") { public void actionPerformed(ActionEvent arg0) { *************** *** 288,307 **** }; pm.add(envelope); ! AbstractAction flip = new SpaceMenuAction(sp, "Rotate 90 degrees CCW") { ! public void actionPerformed(ActionEvent arg0) { ! Iterator it = space.collect().iterator(); ! Vertex center = space.center(); ! while (it.hasNext()) { ! Geometry.rotate(Math.PI / 2, ! 0, 0, 1, ! (Vertex)it.next(), ! center); ! } ! space.changed(); ! Project.getInstance().checkpoint(); ! } ! }; ! pm.add(flip); ! AbstractAction check = new SpaceMenuAction(sp, "Check") { public void actionPerformed(ActionEvent arg0) { space.check(); --- 291,295 ---- }; pm.add(envelope); ! AbstractAction check = new SpaceMenuAction(sp, "Consistency Check") { public void actionPerformed(ActionEvent arg0) { space.check(); *************** *** 309,313 **** }; pm.add(check); ! AbstractAction modCheck = new SpaceMenuAction(sp, "modCheck") { public void actionPerformed(ActionEvent arg0) { log.info(space.getModellor()); --- 297,301 ---- }; pm.add(check); ! AbstractAction modCheck = new SpaceMenuAction(sp, "Modellor Check") { public void actionPerformed(ActionEvent arg0) { log.info(space.getModellor()); *************** *** 315,345 **** }; pm.add(modCheck); ! pm.add(getTransformMenu(sp)); ! ! for (Modellor current : Modellor.getRegisteredModellors()) { ! if (current.application() == Modellor.DETAIL) { ! AbstractAction action = new ModellorAction(current, sp) { ! public void actionPerformed(ActionEvent e) { ! System.out.println("detail " + modellor); ! Modellor detailer = modellor.newInstance(space); ! Project.getInstance().changed(Project.getInstance()); ! Project.getInstance().addObserver(detailer); ! } ! }; ! pm.add(action); ! } ! } ! ! JMenu mm = new JMenu("Modellors"); ! Collection c = Modellor.getRegisteredModellors(); ! Iterator iter = c.iterator(); ! while (iter.hasNext()) { ! Modellor m = (Modellor)iter.next(); ! AbstractAction modellor = new ModellorMenuAction(sp, m); ! mm.add(modellor); } - pm.add(mm); } ! } return pm; } --- 303,334 ---- }; pm.add(modCheck); ! } ! ! pm.add(getTransformMenu(sp)); ! ! for (Modellor current : Modellor.getRegisteredModellors()) { ! if (current.application() == Modellor.DETAIL) { ! AbstractAction action = new ModellorAction(current, sp) { ! public void actionPerformed(ActionEvent e) { ! System.out.println("detail " + modellor); ! Modellor detailer = modellor.newInstance(space); ! Project.getInstance().changed(Project.getInstance()); ! Project.getInstance().addObserver(detailer); ! } ! }; ! pm.add(action); } } ! ! JMenu mm = new JMenu("Modellors"); ! Collection c = Modellor.getRegisteredModellors(); ! Iterator iter = c.iterator(); ! while (iter.hasNext()) { ! Modellor m = (Modellor)iter.next(); ! AbstractAction modellor = new ModellorMenuAction(sp, m); ! mm.add(modellor); ! } ! pm.add(mm); ! } return pm; } |
From: Michael L. <he...@us...> - 2007-10-26 08:59:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32590/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java Log Message: Hilite of unions Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Display.java 25 Oct 2007 12:05:51 -0000 1.41 --- Display.java 26 Oct 2007 08:58:40 -0000 1.42 *************** *** 994,998 **** --- 994,1003 ---- if (current instanceof Space) { Space space = (Space) current; + Collection<Surface> envelope = space.getEnvelope(); + if (envelope.isEmpty()) { + envelope.addAll(space.getSurfaces()); + } + Collection<Edge> edges = Surface.edges(envelope); paintEdges(edges, redish, 2.0f); |
From: Michael L. <he...@us...> - 2007-10-25 12:06:12
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15727/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java Log Message: Small improvement of drawing of constructors Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Display.java 23 Oct 2007 13:13:36 -0000 1.40 --- Display.java 25 Oct 2007 12:05:51 -0000 1.41 *************** *** 624,628 **** --- 624,632 ---- private static void draw(Line line) { Edge edge = line.edge(grid.size()); + + gl.glDepthMask(false); draw(edge); + gl.glDepthMask(true); + if (line.isEditable()) { Vertex from = line.getOrigin(); *************** *** 920,925 **** gl.glDepthMask(false); draw(grid); - paintConstructors(constructors); gl.glDepthMask(true); } } --- 924,930 ---- gl.glDepthMask(false); draw(grid); gl.glDepthMask(true); + paintConstructors(constructors); + } } |
From: Michael L. <he...@us...> - 2007-10-25 09:35:39
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20792/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: Improvement to movetool Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** FinalMoveTool.java 25 Oct 2007 08:42:14 -0000 1.28 --- FinalMoveTool.java 25 Oct 2007 09:35:41 -0000 1.29 *************** *** 39,42 **** --- 39,43 ---- private Collection<Geometric> geometrics; + private Space owner; private Collection<Geometric> affected; *************** *** 201,215 **** private void computePlanes(Collection<Vertex> vertices) { if (vertices.size() > 0) { - Space space = vertices.iterator().next().getOwner(); Set<Vertex> mark = new HashSet(); Set<Edge> edges = new HashSet(); Set<Surface> surfaces = new HashSet(); mark.addAll(vertices); ! for (Edge current : space.getEdges()) { if (mark.contains(current.getFrom()) && mark.contains(current.getTo())) { edges.add(current); } } ! for (Surface current : space.getSurfaces()) { if (edges.containsAll(current.getEdges())) { surfaces.add(current); --- 202,215 ---- private void computePlanes(Collection<Vertex> vertices) { if (vertices.size() > 0) { Set<Vertex> mark = new HashSet(); Set<Edge> edges = new HashSet(); Set<Surface> surfaces = new HashSet(); mark.addAll(vertices); ! for (Edge current : owner.getEdges()) { if (mark.contains(current.getFrom()) && mark.contains(current.getTo())) { edges.add(current); } } ! for (Surface current : owner.getSurfaces()) { if (edges.containsAll(current.getEdges())) { surfaces.add(current); *************** *** 239,245 **** private Map<Vertex, Direction> computeDirectionMap(Collection<Vertex> vertices) { if (vertices.size() > 0) { ! Space space = vertices.iterator().next().getOwner(); Map<Vertex, Direction> slidemap = new HashMap(); ! Map<Vertex, Collection<Edge>> edgemap = space.edgeMap(vertices); for (Vertex current : vertices) { --- 239,245 ---- private Map<Vertex, Direction> computeDirectionMap(Collection<Vertex> vertices) { if (vertices.size() > 0) { ! Map<Vertex, Direction> slidemap = new HashMap(); ! Map<Vertex, Collection<Edge>> edgemap = owner.edgeMap(vertices); for (Vertex current : vertices) { *************** *** 418,426 **** } ! Space owner = Project.getInstance().getActiveSpace(); for (Geometric current : geometrics) { if (current.getOwner() != owner) { GUI.getInstance().alert("All objects must belong to active space"); ! geometrics = null; return; } --- 418,426 ---- } ! owner = Project.getInstance().getActiveSpace(); for (Geometric current : geometrics) { if (current.getOwner() != owner) { GUI.getInstance().alert("All objects must belong to active space"); ! cleanUp(); return; } *************** *** 448,453 **** } } else { - Geometric geometric = geometrics.iterator().next(); - Space owner = geometric.getOwner(); if (copy) { owner.removeProtected(geometrics); --- 448,451 ---- *************** *** 501,505 **** public void cleanUp() { if (start != null) { ! mover.revert(); } super.cleanUp(); --- 499,505 ---- public void cleanUp() { if (start != null) { ! if (mover != null) { ! mover.revert(); ! } } super.cleanUp(); *************** *** 513,516 **** --- 513,517 ---- copy = false; mover = null; + owner = null; } |
From: Michael L. <he...@us...> - 2007-10-25 09:28:00
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17578/src/net/sourceforge/bprocessor/gl/tool Modified Files: RectTool.java Log Message: bug fixed that caused interior surfaces to mistakenly become part of the envelope of the owning space Index: RectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RectTool.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** RectTool.java 2 Oct 2007 06:42:09 -0000 1.22 --- RectTool.java 25 Oct 2007 09:28:02 -0000 1.23 *************** *** 174,185 **** Surface exterior = current.getExterior(); if (exterior != null) { ! Vertex n1 = current.normal(); ! Vertex n2 = exterior.normal(); ! if (n1.dot(n2) > 0) { ! current.setFrontDomain(exterior.getFrontDomain()); ! current.setBackDomain(exterior.getBackDomain()); ! } else { ! current.setFrontDomain(exterior.getBackDomain()); ! current.setBackDomain(exterior.getFrontDomain()); } } --- 174,187 ---- Surface exterior = current.getExterior(); if (exterior != null) { ! if (exterior.getOwner() == current.getOwner()) { ! Vertex n1 = current.normal(); ! Vertex n2 = exterior.normal(); ! if (n1.dot(n2) > 0) { ! current.setFrontDomain(exterior.getFrontDomain()); ! current.setBackDomain(exterior.getBackDomain()); ! } else { ! current.setFrontDomain(exterior.getBackDomain()); ! current.setBackDomain(exterior.getFrontDomain()); ! } } } |
From: Michael L. <he...@us...> - 2007-10-25 08:42:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31699/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: Added an alert to movetool Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** FinalMoveTool.java 22 Oct 2007 19:32:03 -0000 1.27 --- FinalMoveTool.java 25 Oct 2007 08:42:14 -0000 1.28 *************** *** 20,23 **** --- 20,24 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.View; + import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Direction; *************** *** 406,409 **** --- 407,411 ---- @Override protected void pressed(MouseEvent e) { + if (geometrics == null) { geometrics = new LinkedList(); *************** *** 416,419 **** --- 418,430 ---- } + Space owner = Project.getInstance().getActiveSpace(); + for (Geometric current : geometrics) { + if (current.getOwner() != owner) { + GUI.getInstance().alert("All objects must belong to active space"); + geometrics = null; + return; + } + } + if (!geometrics.isEmpty()) { copy = e.isAltDown(); *************** *** 437,441 **** } } else { ! Geometric geometric = affected.iterator().next(); Space owner = geometric.getOwner(); if (copy) { --- 448,452 ---- } } else { ! Geometric geometric = geometrics.iterator().next(); Space owner = geometric.getOwner(); if (copy) { |
From: Michael L. <he...@us...> - 2007-10-24 16:05:03
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5173/src/net/sourceforge/bprocessor/model Modified Files: Geometry.java Command.java CoordinateSystem.java Log Message: some simplification Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Command.java 24 Oct 2007 07:45:43 -0000 1.14 --- Command.java 24 Oct 2007 16:04:54 -0000 1.15 *************** *** 336,340 **** current.setZ(current.getZ() * sz); } ! locals = system.unTranslate(locals, false); for (int i = 0; i < locals.size(); i++) { Vertex v1 = vertices.get(i); --- 336,340 ---- current.setZ(current.getZ() * sz); } ! locals = system.unTranslate(locals); for (int i = 0; i < locals.size(); i++) { Vertex v1 = vertices.get(i); *************** *** 381,385 **** current.setZ(current.getZ() + sz); } ! locals = system.unTranslate(locals, false); for (int i = 0; i < locals.size(); i++) { Vertex v1 = vertices.get(i); --- 381,385 ---- current.setZ(current.getZ() + sz); } ! locals = system.unTranslate(locals); for (int i = 0; i < locals.size(); i++) { Vertex v1 = vertices.get(i); *************** *** 422,426 **** current.set(rotated); } ! locals = system.unTranslate(locals, false); for (int i = 0; i < locals.size(); i++) { Vertex v1 = vertices.get(i); --- 422,426 ---- current.set(rotated); } ! locals = system.unTranslate(locals); for (int i = 0; i < locals.size(); i++) { Vertex v1 = vertices.get(i); Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** Geometry.java 3 Oct 2007 10:02:18 -0000 1.62 --- Geometry.java 24 Oct 2007 16:04:54 -0000 1.63 *************** *** 983,987 **** CoordinateSystem system) { List<Vertex> vertices = new LinkedList<Vertex>(collect(geometry)); ! List<Vertex> unTranslatedVertices = system.unTranslate(vertices, true); Iterator it = vertices.iterator(); Iterator unTranslatedIt = unTranslatedVertices.iterator(); --- 983,987 ---- CoordinateSystem system) { List<Vertex> vertices = new LinkedList<Vertex>(collect(geometry)); ! List<Vertex> unTranslatedVertices = system.unTranslate(vertices); Iterator it = vertices.iterator(); Iterator unTranslatedIt = unTranslatedVertices.iterator(); Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** CoordinateSystem.java 12 Oct 2007 13:14:46 -0000 1.59 --- CoordinateSystem.java 24 Oct 2007 16:04:54 -0000 1.60 *************** *** 459,466 **** * the global coordinate system * @param vertex The vertex to un-translate - * @param modify True if the existing vertex should be modified false otherwise * @return The un-translated vertex */ ! public Vertex unTranslate(Vertex vertex, boolean modify) { Vertex ii = i.copy(); ii.scale(vertex.getX()); --- 459,465 ---- * the global coordinate system * @param vertex The vertex to un-translate * @return The un-translated vertex */ ! public Vertex unTranslate(Vertex vertex) { Vertex ii = i.copy(); ii.scale(vertex.getX()); *************** *** 469,490 **** Vertex nn = n.copy(); nn.scale(vertex.getZ()); ! Vertex tmp = getOrigin().add(ii).add(jj).add(nn); ! if (modify) { ! vertex.setX(tmp.getX()); ! vertex.setY(tmp.getY()); ! vertex.setZ(tmp.getZ()); ! tmp = vertex; ! } ! return tmp; ! } ! ! /** ! * Return the vertex translated from the CoordinateSystem to ! * the global coordinate system ! * @param vertex The vertex to un-translate ! * @return The un-translated vertex ! */ ! public Vertex unTranslate(Vertex vertex) { ! return unTranslate(vertex, false); } --- 468,473 ---- Vertex nn = n.copy(); nn.scale(vertex.getZ()); ! Vertex result = getOrigin().add(ii).add(jj).add(nn); ! return result; } *************** *** 505,515 **** * Untranslate all vertices in the list * @param vertices The list of vertices - * @param modify true if the existing vertexes should be kept false if they should be copied * @return The untranslated list */ ! public List<Vertex> unTranslate(Collection<Vertex> vertices, boolean modify) { List<Vertex> result = new ArrayList<Vertex>(); for (Vertex current : vertices) { ! result.add(unTranslate(current, modify)); } return result; --- 488,497 ---- * Untranslate all vertices in the list * @param vertices The list of vertices * @return The untranslated list */ ! public List<Vertex> unTranslate(Collection<Vertex> vertices) { List<Vertex> result = new ArrayList<Vertex>(); for (Vertex current : vertices) { ! result.add(unTranslate(current)); } return result; |
From: rimestad <rim...@us...> - 2007-10-24 07:45:42
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2498/src/net/sourceforge/bprocessor/model Modified Files: Command.java Log Message: added checkpoints on all evaluations Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Command.java 24 Oct 2007 06:48:23 -0000 1.13 --- Command.java 24 Oct 2007 07:45:43 -0000 1.14 *************** *** 128,131 **** --- 128,132 ---- Surface face = new Surface(contour); owner.insert(face); + Project.getInstance().checkpoint(); } } *************** *** 171,174 **** --- 172,176 ---- } Project.getInstance().changed(Project.getInstance()); + Project.getInstance().checkpoint(); } } *************** *** 204,209 **** for (int i = 0; i < s; i++) { double val = i * Math.PI * 2 / s; ! double sin = Math.sin(val); ! double cos = Math.cos(val); Vertex cur = new Vertex(cos, sin, 0); if (first == null) { --- 206,211 ---- for (int i = 0; i < s; i++) { double val = i * Math.PI * 2 / s; ! double sin = Math.sin(val) * r; ! double cos = Math.cos(val) * r; Vertex cur = new Vertex(cos, sin, 0); if (first == null) { *************** *** 244,247 **** --- 246,250 ---- world.insert(top); Project.getInstance().changed(world); + Project.getInstance().checkpoint(); } } *************** *** 295,298 **** --- 298,302 ---- world.insert(top); Project.getInstance().changed(world); + Project.getInstance().checkpoint(); } } *************** *** 339,342 **** --- 343,347 ---- } Project.getInstance().changed(Project.getInstance()); + Project.getInstance().checkpoint(); } } |
From: rimestad <rim...@us...> - 2007-10-24 07:45:13
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2456/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Turned off two sided lighting as it aint used, and removed setting that only consern specular light which we dont use (GL_LIGHT_MODEL_LOCAL_VIEWER) Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.253 retrieving revision 1.254 diff -C2 -d -r1.253 -r1.254 *** View.java 16 Oct 2007 11:02:53 -0000 1.253 --- View.java 24 Oct 2007 07:45:10 -0000 1.254 *************** *** 508,513 **** gl.glEnable(GL.GL_LIGHT0); ! gl.glLightModeli(GL.GL_LIGHT_MODEL_TWO_SIDE, 1); ! gl.glLightModeli(GL.GL_LIGHT_MODEL_LOCAL_VIEWER, 1); gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, new float[] {0.3f, 0.3f, 0.3f, 1.0f}, 0); gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, new float[] {0.7f, 0.7f, 0.7f, 1.0f}, 0); --- 508,513 ---- gl.glEnable(GL.GL_LIGHT0); ! //Tell if both sides of the model should be lighted ! gl.glLightModeli(GL.GL_LIGHT_MODEL_TWO_SIDE, 0); gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, new float[] {0.3f, 0.3f, 0.3f, 1.0f}, 0); gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, new float[] {0.7f, 0.7f, 0.7f, 1.0f}, 0); |
From: Michael L. <he...@us...> - 2007-10-24 06:48:32
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11890/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: Translate and Rotate commands Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** PopupMenu.java 22 Oct 2007 19:26:36 -0000 1.55 --- PopupMenu.java 24 Oct 2007 06:48:28 -0000 1.56 *************** *** 534,537 **** --- 534,566 ---- menu.add(action); } + { + AbstractAction action = new GeometricMenuAction(arguments, "Translate...") { + public void actionPerformed(ActionEvent event) { + Set<Vertex> vertices = Geometry.collect(entities); + Vertex center = Vertex.center(vertices); + CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); + system = system.copy(); + system.setOrigin(center); + Command command = new Command.Translate(vertices, system); + AttributeView.instance().display(command); + } + }; + menu.add(action); + } + { + AbstractAction action = new GeometricMenuAction(arguments, "Rotate...") { + public void actionPerformed(ActionEvent event) { + Set<Vertex> vertices = Geometry.collect(entities); + Vertex center = Vertex.center(vertices); + CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); + system = system.copy(); + system.setOrigin(center); + Command command = new Command.Rotate(vertices, system); + AttributeView.instance().display(command); + } + }; + menu.add(action); + } + return menu; } |
From: Michael L. <he...@us...> - 2007-10-24 06:48:32
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11890/src/net/sourceforge/bprocessor/gui/actions Modified Files: ImportFileReader.java Log Message: Translate and Rotate commands Index: ImportFileReader.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/ImportFileReader.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ImportFileReader.java 22 Oct 2007 19:26:36 -0000 1.7 --- ImportFileReader.java 24 Oct 2007 06:48:28 -0000 1.8 *************** *** 164,168 **** s.setBackDomain(currentGroup); if (!normals.isEmpty()) { ! //s.setNormals(normals); } surfaces.add(s); --- 164,168 ---- s.setBackDomain(currentGroup); if (!normals.isEmpty()) { ! s.setNormals(normals); } surfaces.add(s); |
From: Michael L. <he...@us...> - 2007-10-24 06:48:27
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11879/src/net/sourceforge/bprocessor/model Modified Files: Command.java Log Message: Translate and Rotate commands Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Command.java 22 Oct 2007 19:26:32 -0000 1.12 --- Command.java 24 Oct 2007 06:48:23 -0000 1.13 *************** *** 233,237 **** normals.add(normal); } ! //surface.setNormals(normals); world.insert(surface); } --- 233,237 ---- normals.add(normal); } ! surface.setNormals(normals); world.insert(surface); } *************** *** 314,318 **** this.vertices = new LinkedList(vertices); this.system = system; - parameters.put("vertices", vertices); parameters.put("system", system); parameters.put("scale x", 1.0); --- 314,317 ---- *************** *** 342,344 **** --- 341,429 ---- } } + + /** + * + * + */ + public static class Translate extends Command { + private List<Vertex> vertices; + private CoordinateSystem system; + + /** + * Scale a collection of vertices + * @param vertices The list of verts + * @param system The system to translate into + */ + public Translate(Collection<Vertex> vertices, CoordinateSystem system) { + this.vertices = new LinkedList(vertices); + this.system = system; + parameters.put("system", system); + parameters.put("translate x", 0.0); + parameters.put("translate y", 0.0); + parameters.put("translate z", 0.0); + } + + /** {@inheritDoc} */ + @Override + public void evaluate() { + List<Vertex> locals = system.translate(vertices); + double sx = parameters.getDouble("translate x"); + double sy = parameters.getDouble("translate y"); + double sz = parameters.getDouble("translate z"); + for (Vertex current : locals) { + current.setX(current.getX() + sx); + current.setY(current.getY() + sy); + current.setZ(current.getZ() + sz); + } + locals = system.unTranslate(locals, false); + for (int i = 0; i < locals.size(); i++) { + Vertex v1 = vertices.get(i); + Vertex v2 = locals.get(i); + v1.set(v2); + } + Project.getInstance().changed(Project.getInstance()); + } + } + + /** + * + * + */ + public static class Rotate extends Command { + private List<Vertex> vertices; + private CoordinateSystem system; + + /** + * Scale a collection of vertices + * @param vertices The list of verts + * @param system The system to translate into + */ + public Rotate(Collection<Vertex> vertices, CoordinateSystem system) { + this.vertices = new LinkedList(vertices); + this.system = system; + parameters.put("system", system); + parameters.put("angle", 0.0); + } + + /** {@inheritDoc} */ + @Override + public void evaluate() { + List<Vertex> locals = system.translate(vertices); + double angle = parameters.getDouble("angle"); + AxisRotate rotate = new AxisRotate(); + rotate.angle(angle); + for (Vertex current : locals) { + Vertex rotated = rotate.transform(current); + current.set(rotated); + } + locals = system.unTranslate(locals, false); + for (int i = 0; i < locals.size(); i++) { + Vertex v1 = vertices.get(i); + Vertex v2 = locals.get(i); + v1.set(v2); + } + Project.getInstance().changed(Project.getInstance()); + } + } + } |
From: rimestad <rim...@us...> - 2007-10-23 13:13:41
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29426/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java Log Message: Made display use normals properly Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Display.java 23 Oct 2007 07:20:44 -0000 1.39 --- Display.java 23 Oct 2007 13:13:36 -0000 1.40 *************** *** 112,116 **** glu.gluTessProperty(tesselator, GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_ODD); - byte b1 = (byte) 0x88; byte b2 = (byte) 0x22; --- 112,115 ---- *************** *** 191,195 **** public void vertex(Object object) { double[] vertex = (double[]) object; ! gl.glNormal3dv(vertex, 3); gl.glVertex3dv(vertex, 0); } --- 190,196 ---- public void vertex(Object object) { double[] vertex = (double[]) object; ! if (vertex.length >= 6) { ! gl.glNormal3dv(vertex, 3); ! } gl.glVertex3dv(vertex, 0); } *************** *** 527,533 **** Vertex normal = surface.normal(); for (Vertex current : vertices) { ! double[] content = new double[6]; if (normals != null) { normal = normals.get(index % normals.size()); if (reverse) { content[3] = -normal.getX(); --- 528,535 ---- Vertex normal = surface.normal(); for (Vertex current : vertices) { ! double[] content = null; if (normals != null) { normal = normals.get(index % normals.size()); + content = new double[6]; if (reverse) { content[3] = -normal.getX(); *************** *** 542,548 **** } } ! content[0] = current.getX(); ! content[1] = current.getY(); ! content[2] = current.getZ(); glu.gluTessVertex(tesselator, content, 0, content); } --- 544,554 ---- } } ! if (content == null) { ! content = current.values(); ! } else { ! content[0] = current.getX(); ! content[1] = current.getY(); ! content[2] = current.getZ(); ! } glu.gluTessVertex(tesselator, content, 0, content); } |
From: rimestad <rim...@us...> - 2007-10-23 07:20:45
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18151/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: smooth normals Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.196 retrieving revision 1.197 diff -C2 -d -r1.196 -r1.197 *** Surface.java 16 Oct 2007 13:31:29 -0000 1.196 --- Surface.java 23 Oct 2007 07:20:48 -0000 1.197 *************** *** 55,58 **** --- 55,59 ---- private Material backMaterial; + private List<Vertex> normals; /** LEFT means counterclockwise */ *************** *** 656,660 **** for (int i = 0; i < n; i++) { ! vmap[i] = v[i].copy().add(normal); } --- 657,661 ---- for (int i = 0; i < n; i++) { ! vmap[i] = v[i].add(normal); } *************** *** 939,943 **** Vertex normal = normal(); Plane p = new Plane(normal.getX(), normal.getY(), normal.getZ(), this.getFirstVertex()); ! boolean makeNewTop = true; List<Vertex> vertices = getVertices(); --- 940,944 ---- Vertex normal = normal(); Plane p = new Plane(normal.getX(), normal.getY(), normal.getZ(), this.getFirstVertex()); ! boolean makeNewTop = false; List<Vertex> vertices = getVertices(); *************** *** 994,1000 **** v2dir.put(v[i], new Direction(vmap[i], tempNormal, min, max)); } } else { // We just have to move the existing point - makeNewTop = false; Collection<Edge> connected = v[i].getEdges(); connected.removeAll(this.getEdges()); --- 995,1001 ---- v2dir.put(v[i], new Direction(vmap[i], tempNormal, min, max)); } + makeNewTop = true; } else { // We just have to move the existing point Collection<Edge> connected = v[i].getEdges(); connected.removeAll(this.getEdges()); *************** *** 1043,1047 **** topmap[i] = (Edge)e2e.get(e[i]); } else { ! if (vmap[i] == v[i] || vmap[(i + 1) % n] == v[(i + 1) % n]) { topmap[i] = e[i]; } else { --- 1044,1048 ---- topmap[i] = (Edge)e2e.get(e[i]); } else { ! if (vmap[i] == v[i] && vmap[(i + 1) % n] == v[(i + 1) % n]) { topmap[i] = e[i]; } else { *************** *** 1051,1055 **** } } ! List<Edge> lst = new LinkedList<Edge>(); for (int i = 0; i < n; i++) { --- 1052,1056 ---- } } ! List<Edge> lst = new LinkedList<Edge>(); for (int i = 0; i < n; i++) { *************** *** 1105,1109 **** } } ! this.setEdges(lst); for (int i = 0; i < n; i++) { --- 1106,1110 ---- } } ! //this.setEdges(lst); for (int i = 0; i < n; i++) { *************** *** 1111,1129 **** facemap[i] = (Surface)e2s.get(e[i]); } else { ! if (sidemap[i] == null || sidemap[(i + 1) % n] == null) { ! // We should not make a new surface } else { ! Edge b = e[i]; ! Edge r = sidemap[i]; ! Edge l = sidemap[(i + 1) % n]; ! Edge t = topmap[i]; ! List<Edge> newEdges = new LinkedList<Edge>(); ! newEdges.add(r); ! newEdges.add(t); ! newEdges.add(l); ! newEdges.add(b); ! facemap[i] = new Surface(newEdges); ! e2s.put(b, facemap[i]); ! extrusion.add(facemap[i]); } } --- 1112,1157 ---- facemap[i] = (Surface)e2s.get(e[i]); } else { ! if (sidemap[i] != null) { ! if (sidemap[(i + 1) % n] != null) { ! //New quadratic surface ! Edge b = e[i]; ! Edge r = sidemap[i]; ! Edge l = sidemap[(i + 1) % n]; ! Edge t = topmap[i]; ! List<Edge> newEdges = new LinkedList<Edge>(); ! newEdges.add(r); ! newEdges.add(t); ! newEdges.add(l); ! newEdges.add(b); ! facemap[i] = new Surface(newEdges); ! e2s.put(b, facemap[i]); ! extrusion.add(facemap[i]); ! } else { ! //new triangular surface with the prev edge. ! Edge b = e[i]; ! Edge r = sidemap[i]; ! Edge t = topmap[i]; ! List<Edge> newEdges = new LinkedList<Edge>(); ! newEdges.add(b); ! newEdges.add(r); ! newEdges.add(t); ! facemap[i] = new Surface(newEdges); ! e2s.put(b, facemap[i]); ! extrusion.add(facemap[i]); ! } } else { ! if (sidemap[(i + 1) % n] != null) { ! // new triangular surface with the next edge ! Edge b = e[i]; ! Edge l = sidemap[(i + 1) % n]; ! Edge t = topmap[i]; ! List<Edge> newEdges = new LinkedList<Edge>(); ! newEdges.add(t); ! newEdges.add(l); ! newEdges.add(b); ! facemap[i] = new Surface(newEdges); ! e2s.put(b, facemap[i]); ! extrusion.add(facemap[i]); ! } } } *************** *** 2094,2096 **** --- 2122,2138 ---- return true; } + + /** + * @return the normals + */ + public List<Vertex> getNormals() { + return normals; + } + + /** + * @param normals the normals to set + */ + public void setNormals(List<Vertex> normals) { + this.normals = normals; + } } |
From: rimestad <rim...@us...> - 2007-10-23 07:20:41
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18143/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java Log Message: smooth normals Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Display.java 19 Oct 2007 12:17:22 -0000 1.38 --- Display.java 23 Oct 2007 07:20:44 -0000 1.39 *************** *** 112,115 **** --- 112,116 ---- glu.gluTessProperty(tesselator, GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_ODD); + byte b1 = (byte) 0x88; byte b2 = (byte) 0x22; *************** *** 185,193 **** gl.glEnd(); } ! /** {@inheritDoc} */ public void vertex(Object object) { ! Vertex vertex = (Vertex) object; ! gl.glVertex3d(vertex.getX(), vertex.getY(), vertex.getZ()); } } --- 186,202 ---- gl.glEnd(); } ! /** {@inheritDoc} */ + @Override public void vertex(Object object) { ! double[] vertex = (double[]) object; ! gl.glNormal3dv(vertex, 3); ! gl.glVertex3dv(vertex, 0); ! } ! ! /** {@inheritDoc} */ ! @Override ! public void error(int arg0) { ! System.out.println(glu.gluErrorString(arg0)); } } *************** *** 451,454 **** --- 460,464 ---- private static void paintSurfaces(Collection<Surface> surfaces, boolean transparency) { gl.glEnable(GL.GL_LIGHTING); + gl.glShadeModel(GL.GL_SMOOTH); gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); gl.glPolygonOffset(1.0f, 1.0f); *************** *** 463,467 **** paint(current, color, 1.0f, false); } else if (transparency) { - paint(current, color, 0.3f, false); } --- 473,476 ---- *************** *** 499,503 **** for (Surface current : surface.getHoles()) { if (surface.getOwner() == current.getOwner()) { ! drawContour(current, false); } } --- 508,512 ---- for (Surface current : surface.getHoles()) { if (surface.getOwner() == current.getOwner()) { ! drawContour(current, reverse); } } *************** *** 507,518 **** private static void drawContour(Surface surface, boolean reverse) { List<Vertex> vertices = surface.getVertices(); if (vertices.size() > 2) { vertices.add(vertices.get(0)); if (reverse) { Collections.reverse(vertices); } glu.gluTessBeginContour(tesselator); for (Vertex current : vertices) { ! glu.gluTessVertex(tesselator, current.values(), 0, current); } glu.gluTessEndContour(tesselator); --- 516,549 ---- private static void drawContour(Surface surface, boolean reverse) { List<Vertex> vertices = surface.getVertices(); + List<Vertex> normals = surface.getNormals(); + int index = 0; if (vertices.size() > 2) { vertices.add(vertices.get(0)); if (reverse) { Collections.reverse(vertices); + index = vertices.size() - 1; } glu.gluTessBeginContour(tesselator); + Vertex normal = surface.normal(); for (Vertex current : vertices) { ! double[] content = new double[6]; ! if (normals != null) { ! normal = normals.get(index % normals.size()); ! if (reverse) { ! content[3] = -normal.getX(); ! content[4] = -normal.getY(); ! content[5] = -normal.getZ(); ! index--; ! } else { ! content[3] = normal.getX(); ! content[4] = normal.getY(); ! content[5] = normal.getZ(); ! index++; ! } ! } ! content[0] = current.getX(); ! content[1] = current.getY(); ! content[2] = current.getZ(); ! glu.gluTessVertex(tesselator, content, 0, content); } glu.gluTessEndContour(tesselator); |
From: Michael L. <he...@us...> - 2007-10-22 19:32:03
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24896/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: removed some feedback from final move tool Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** FinalMoveTool.java 16 Oct 2007 11:02:57 -0000 1.26 --- FinalMoveTool.java 22 Oct 2007 19:32:03 -0000 1.27 *************** *** 330,338 **** if (current != null) { Collection feedback = new LinkedList(); - for (Vertex vertex : vertices) { - Edge edge = new Edge(current.vertex(), vertex); - edge.setStrippled(true); - feedback.add(edge); - } feedback(feedback); makeTarget(current); --- 330,333 ---- |
From: Michael L. <he...@us...> - 2007-10-22 19:26:34
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22864/src/net/sourceforge/bprocessor/gui/actions Modified Files: ImportFileReader.java Log Message: New scale command Commented out some setNormals calls Index: ImportFileReader.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/ImportFileReader.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ImportFileReader.java 22 Oct 2007 15:20:37 -0000 1.6 --- ImportFileReader.java 22 Oct 2007 19:26:36 -0000 1.7 *************** *** 164,168 **** s.setBackDomain(currentGroup); if (!normals.isEmpty()) { ! s.setNormals(normals); } surfaces.add(s); --- 164,168 ---- s.setBackDomain(currentGroup); if (!normals.isEmpty()) { ! //s.setNormals(normals); } surfaces.add(s); |
From: Michael L. <he...@us...> - 2007-10-22 19:26:34
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22864/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: New scale command Commented out some setNormals calls Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** PopupMenu.java 22 Oct 2007 15:21:26 -0000 1.54 --- PopupMenu.java 22 Oct 2007 19:26:36 -0000 1.55 *************** *** 524,528 **** --- 524,531 ---- public void actionPerformed(ActionEvent event) { Set<Vertex> vertices = Geometry.collect(entities); + Vertex center = Vertex.center(vertices); CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); + system = system.copy(); + system.setOrigin(center); Command command = new Command.Scale(vertices, system); AttributeView.instance().display(command); |
From: Michael L. <he...@us...> - 2007-10-22 19:26:31
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22852/src/net/sourceforge/bprocessor/model Modified Files: Vertex.java Command.java Log Message: New scale command Commented out some setNormals calls Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Command.java 22 Oct 2007 15:21:18 -0000 1.11 --- Command.java 22 Oct 2007 19:26:32 -0000 1.12 *************** *** 233,237 **** normals.add(normal); } ! surface.setNormals(normals); world.insert(surface); } --- 233,237 ---- normals.add(normal); } ! //surface.setNormals(normals); world.insert(surface); } *************** *** 316,320 **** parameters.put("vertices", vertices); parameters.put("system", system); ! parameters.put("scale", 1.0); } --- 316,322 ---- parameters.put("vertices", vertices); parameters.put("system", system); ! parameters.put("scale x", 1.0); ! parameters.put("scale y", 1.0); ! parameters.put("scale z", 1.0); } *************** *** 323,329 **** public void evaluate() { List<Vertex> locals = system.translate(vertices); ! double scale = parameters.getDouble("scale"); for (Vertex current : locals) { ! current.scale(scale); } locals = system.unTranslate(locals, false); --- 325,335 ---- public void evaluate() { List<Vertex> locals = system.translate(vertices); ! double sx = parameters.getDouble("scale x"); ! double sy = parameters.getDouble("scale y"); ! double sz = parameters.getDouble("scale z"); for (Vertex current : locals) { ! current.setX(current.getX() * sx); ! current.setY(current.getY() * sy); ! current.setZ(current.getZ() * sz); } locals = system.unTranslate(locals, false); Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** Vertex.java 3 Oct 2007 10:02:59 -0000 1.65 --- Vertex.java 22 Oct 2007 19:26:32 -0000 1.66 *************** *** 537,540 **** --- 537,560 ---- } + /** + * Center + * @param vertices collection of vertices + * @return center + */ + public static Vertex center(Collection<Vertex> vertices) { + double x = 0; + double y = 0; + double z = 0; + for (Vertex current : vertices) { + x += current.x; + y += current.y; + z += current.z; + } + x /= vertices.size(); + y /= vertices.size(); + z /= vertices.size(); + return new Vertex(x, y, z); + } + /** * Project this vertex onto the vertex given as argument |
From: rimestad <rim...@us...> - 2007-10-22 15:21:24
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21352/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: added cylinder command Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** PopupMenu.java 22 Oct 2007 11:03:03 -0000 1.53 --- PopupMenu.java 22 Oct 2007 15:21:26 -0000 1.54 *************** *** 547,550 **** --- 547,557 ---- }; menu.add(action); + action = new AbstractAction("Cylinder...") { + public void actionPerformed(ActionEvent event) { + Command command = new Command.Cylinder(); + AttributeView.instance().display(command); + } + }; + menu.add(action); return menu; } |
From: rimestad <rim...@us...> - 2007-10-22 15:21:16
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21334/src/net/sourceforge/bprocessor/model Modified Files: ParameterBlock.java Command.java Log Message: added cylinder command Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Command.java 22 Oct 2007 12:47:32 -0000 1.10 --- Command.java 22 Oct 2007 15:21:18 -0000 1.11 *************** *** 10,15 **** --- 10,17 ---- import java.util.ArrayList; import java.util.Collection; + import java.util.HashSet; import java.util.LinkedList; import java.util.List; + import java.util.Set; *************** *** 155,159 **** public void evaluate() { Edge edge = (Edge) parameters.get("edge"); ! int n = (int) (parameters.getDouble("n")); Vertex from = edge.from; Vertex to = edge.to; --- 157,161 ---- public void evaluate() { Edge edge = (Edge) parameters.get("edge"); ! int n = parameters.getDouble("n").intValue(); Vertex from = edge.from; Vertex to = edge.to; *************** *** 173,176 **** --- 175,251 ---- /** + * A command to create a cylinder + */ + public static class Cylinder extends Command { + /** + * + */ + public Cylinder() { + parameters.add(new Attribute("radius", 1.0)); + parameters.add(new Attribute("height", 3.0)); + parameters.add(new Attribute("slices", 10.0)); + } + + /** {@inheritDoc}} */ + @Override + public String getGeneralName() { + return "Create cylinder"; + } + + /** {@inheritDoc}} */ + @Override + public void evaluate() { + double r = parameters.getDouble("radius"); + double h = parameters.getDouble("height"); + int s = parameters.getDouble("slices").intValue(); + + List<Edge> edges = new LinkedList<Edge>(); + Vertex first = null, prev = null; + for (int i = 0; i < s; i++) { + double val = i * Math.PI * 2 / s; + double sin = Math.sin(val); + double cos = Math.cos(val); + Vertex cur = new Vertex(cos, sin, 0); + if (first == null) { + first = cur; + } + if (prev != null) { + edges.add(new Edge(prev, cur)); + } + prev = cur; + } + edges.add(new Edge(prev, first)); + Surface bottom = new Surface(edges); + Space inside = Project.getInstance().world().createConstructionSpace("Cylinder"); + Space world = Project.getInstance().world(); + bottom.setFrontDomain(inside); + Set<Surface> sides = new HashSet<Surface>(); + Surface top = bottom.extrusion(h, sides); + world.add(inside); + world.insert(bottom); + for (Surface surface : sides) { + List<Vertex> normals = new LinkedList<Vertex>(); + for (Vertex v : surface.getVertices()) { + Vertex normal = v.copy(); + normal.setZ(0); + normal.scale(-1); + normal.normalize(); + normals.add(normal); + } + surface.setNormals(normals); + world.insert(surface); + } + Collection<Edge> visibleEdges = Surface.edges(sides); + visibleEdges.removeAll(top.getEdges()); + visibleEdges.removeAll(bottom.getEdges()); + Project.getInstance().getCurrentCamera().getHiddenGeometrics().addAll(visibleEdges); + sides.add(top); + sides.add(bottom); + world.insert(top); + Project.getInstance().changed(world); + } + } + + /** * * *************** *** 232,238 **** /** ! * ! * @param vertices collecting ! * @param system system */ public Scale(Collection<Vertex> vertices, CoordinateSystem system) { --- 307,313 ---- /** ! * Scale a collection of vertices ! * @param vertices The list of verts ! * @param system The system to translate into */ public Scale(Collection<Vertex> vertices, CoordinateSystem system) { Index: ParameterBlock.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ParameterBlock.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ParameterBlock.java 22 Oct 2007 06:55:09 -0000 1.12 --- ParameterBlock.java 22 Oct 2007 15:21:18 -0000 1.13 *************** *** 80,84 **** * @return double value */ ! public double getDouble(String key) { for (Attribute current : parameters) { if (current.getName().equals(key)) { --- 80,84 ---- * @return double value */ ! public Double getDouble(String key) { for (Attribute current : parameters) { if (current.getName().equals(key)) { |
From: rimestad <rim...@us...> - 2007-10-22 15:20:34
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20930/src/net/sourceforge/bprocessor/gui/actions Modified Files: ImportFileReader.java Log Message: minor fixes and changes Index: ImportFileReader.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/ImportFileReader.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ImportFileReader.java 22 Oct 2007 10:00:17 -0000 1.5 --- ImportFileReader.java 22 Oct 2007 15:20:37 -0000 1.6 *************** *** 82,86 **** Set<Surface> surfaces = new HashSet<Surface>(); Map<Vertex, Set<Edge>> v2es = new HashMap<Vertex, Set<Edge>>(); - Map<Vertex, Vertex> v2normal = new HashMap<Vertex, Vertex>(); List<Space> groups = new LinkedList<Space>(); Map<String, Material> materialMap = new HashMap<String, Material>(); --- 82,85 ---- *************** *** 118,122 **** double y = Double.parseDouble(lineContent[2]); double z = Double.parseDouble(lineContent[3]); ! Vertex v = new Vertex(z, x, y); vertexNormals.add(v); v2es.put(v, new HashSet<Edge>()); --- 117,135 ---- double y = Double.parseDouble(lineContent[2]); double z = Double.parseDouble(lineContent[3]); ! switch (basisPlane) { ! case FileImportActionListener.YZ: ! double tmpy = y; ! y = x; ! x = z; ! z = tmpy; ! break; ! case FileImportActionListener.ZX: ! double tmpx = x; ! x = z; ! z = y; ! y = tmpx; ! break; ! } ! Vertex v = new Vertex(x, y, z); vertexNormals.add(v); v2es.put(v, new HashSet<Edge>()); *************** *** 129,158 **** } else if (lineContent[0].equals("f")) { LinkedList<Edge> edge = new LinkedList<Edge>(); ! int index = 0; String[] vert = lineContent[1].split("/"); ! Vertex first = verts.get(Integer.parseInt(vert[index]) - 1); Vertex cur = first; - if (!vertexTexture.isEmpty()) { - index++; - } if (!vertexNormals.isEmpty()) { ! index++; ! Vertex normal = ! vertexNormals.get(Integer.parseInt(vert[index]) - 1); ! v2normal.put(cur, normal); } Vertex prev = first; for (int i = 2; i < lineContent.length; i++) { - index = 0; vert = lineContent[i].split("/"); ! cur = verts.get(Integer.parseInt(vert[index]) - 1); ! if (!vertexTexture.isEmpty()) { ! index++; ! } if (!vertexNormals.isEmpty()) { ! index++; ! Vertex normal = ! vertexNormals.get(Integer.parseInt(vert[index]) - 1); ! v2normal.put(cur, normal); } Edge e = findEdge(prev, cur, v2es); --- 142,158 ---- } else if (lineContent[0].equals("f")) { LinkedList<Edge> edge = new LinkedList<Edge>(); ! LinkedList<Vertex> normals = new LinkedList<Vertex>(); String[] vert = lineContent[1].split("/"); ! Vertex first = verts.get(Integer.parseInt(vert[0]) - 1); Vertex cur = first; if (!vertexNormals.isEmpty()) { ! normals.add(vertexNormals.get(Integer.parseInt(vert[2]) - 1)); } Vertex prev = first; for (int i = 2; i < lineContent.length; i++) { vert = lineContent[i].split("/"); ! cur = verts.get(Integer.parseInt(vert[0]) - 1); if (!vertexNormals.isEmpty()) { ! normals.add(vertexNormals.get(Integer.parseInt(vert[2]) - 1)); } Edge e = findEdge(prev, cur, v2es); *************** *** 162,167 **** edge.add(findEdge(prev, first, v2es)); Surface s = new Surface(edge); - surfaces.add(s); s.setBackDomain(currentGroup); if (currentMaterial == null) { currentMaterial = new Material("Object", new float[]{0f, 0.9f, 0f}); --- 162,170 ---- edge.add(findEdge(prev, first, v2es)); Surface s = new Surface(edge); s.setBackDomain(currentGroup); + if (!normals.isEmpty()) { + s.setNormals(normals); + } + surfaces.add(s); if (currentMaterial == null) { currentMaterial = new Material("Object", new float[]{0f, 0.9f, 0f}); *************** *** 187,191 **** } for (Space s : groups) { ! into.add(s); } for (Material m : materialMap.values()) { --- 190,194 ---- } for (Space s : groups) { ! into.addProtected(s); } for (Material m : materialMap.values()) { *************** *** 193,203 **** } for (Vertex v : verts) { ! into.add(v); } for (Edge e : edges) { ! into.add(e); } for (Surface s : surfaces) { ! into.add(s); } into.changed(); --- 196,206 ---- } for (Vertex v : verts) { ! into.addProtected(v); } for (Edge e : edges) { ! into.addProtected(e); } for (Surface s : surfaces) { ! into.addProtected(s); } into.changed(); |
From: Michael L. <he...@us...> - 2007-10-22 12:47:31
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25998/src/net/sourceforge/bprocessor/model Modified Files: Command.java Log Message: style error fixed Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Command.java 22 Oct 2007 11:02:59 -0000 1.9 --- Command.java 22 Oct 2007 12:47:32 -0000 1.10 *************** *** 234,239 **** * * @param vertices collecting ! * @param origin vertex ! * @param normal vertex */ public Scale(Collection<Vertex> vertices, CoordinateSystem system) { --- 234,238 ---- * * @param vertices collecting ! * @param system system */ public Scale(Collection<Vertex> vertices, CoordinateSystem system) { |
From: Michael L. <he...@us...> - 2007-10-22 11:03:07
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17481/src/net/sourceforge/bprocessor/model Modified Files: Command.java Log Message: scale Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Command.java 22 Oct 2007 06:55:09 -0000 1.8 --- Command.java 22 Oct 2007 11:02:59 -0000 1.9 *************** *** 228,234 **** */ public static class Scale extends Command { ! private Collection<Vertex> vertices; ! private Vertex origin; ! private Vertex normal; /** --- 228,233 ---- */ public static class Scale extends Command { ! private List<Vertex> vertices; ! private CoordinateSystem system; /** *************** *** 238,248 **** * @param normal vertex */ ! public Scale(Collection<Vertex> vertices, Vertex origin, Vertex normal) { ! this.vertices = vertices; ! this.origin = origin; ! this.normal = normal; parameters.put("vertices", vertices); ! parameters.put("origin", origin); ! parameters.put("normal", normal); parameters.put("scale", 1.0); } --- 237,245 ---- * @param normal vertex */ ! public Scale(Collection<Vertex> vertices, CoordinateSystem system) { ! this.vertices = new LinkedList(vertices); ! this.system = system; parameters.put("vertices", vertices); ! parameters.put("system", system); parameters.put("scale", 1.0); } *************** *** 251,256 **** @Override public void evaluate() { ! // TODO Auto-generated method stub ! } } --- 248,263 ---- @Override public void evaluate() { ! List<Vertex> locals = system.translate(vertices); ! double scale = parameters.getDouble("scale"); ! for (Vertex current : locals) { ! current.scale(scale); ! } ! locals = system.unTranslate(locals, false); ! for (int i = 0; i < locals.size(); i++) { ! Vertex v1 = vertices.get(i); ! Vertex v2 = locals.get(i); ! v1.set(v2); ! } ! Project.getInstance().changed(Project.getInstance()); } } |
From: Michael L. <he...@us...> - 2007-10-22 11:03:02
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17598/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: scale Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** PopupMenu.java 22 Oct 2007 09:53:01 -0000 1.52 --- PopupMenu.java 22 Oct 2007 11:03:03 -0000 1.53 *************** *** 524,528 **** public void actionPerformed(ActionEvent event) { Set<Vertex> vertices = Geometry.collect(entities); ! Command command = new Command.Scale(vertices, new Vertex(0, 0, 0), new Vertex(0, 0, 1)); AttributeView.instance().display(command); } --- 524,529 ---- public void actionPerformed(ActionEvent event) { Set<Vertex> vertices = Geometry.collect(entities); ! CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); ! Command command = new Command.Scale(vertices, system); AttributeView.instance().display(command); } |