bprocessor-commit Mailing List for B-processor (Page 26)
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...> - 2008-01-25 13:40:14
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9879/src/net/sourceforge/bprocessor/model Modified Files: SpaceAnalysis.java Log Message: superfluous line deleted Index: SpaceAnalysis.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SpaceAnalysis.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SpaceAnalysis.java 13 Dec 2007 12:00:31 -0000 1.10 --- SpaceAnalysis.java 25 Jan 2008 13:40:10 -0000 1.11 *************** *** 159,163 **** minimum = angle; selected = current; - selected = current; Surface exterior = selected.getExterior(); if (exterior != null) { --- 159,162 ---- |
From: Michael L. <he...@us...> - 2008-01-25 13:06:08
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30717/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: Cylinder Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** GUI.java 27 Dec 2007 23:14:30 -0000 1.93 --- GUI.java 25 Jan 2008 13:06:06 -0000 1.94 *************** *** 141,156 **** instance = this; ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); - System.out.println("enabled " + ToolTipManager.sharedInstance().isLightWeightPopupEnabled()); createMenus(); createMainView(); start(); - /** - * FIXME there have to be some kind of thread lock on - * project to avoid concurrent modification before enabling spacecheck - */ - /* - Thread sc = new SpaceChecker(); - sc.start(); - */ } --- 141,147 ---- *************** *** 690,694 **** splitPaneLeftRight = new JSplitPane(); - System.out.println("divider " + splitPaneLeftRight.getDividerSize()); splitPaneLeftRight.setDividerSize(7); splitPaneLeftRight.setRightComponent(splitPaneMiddleRight); --- 681,684 ---- |
From: Michael L. <he...@us...> - 2008-01-25 13:06:05
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30394/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Geometry.java Command.java Log Message: Cylinder Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.218 retrieving revision 1.219 diff -C2 -d -r1.218 -r1.219 *** Surface.java 24 Jan 2008 10:35:35 -0000 1.218 --- Surface.java 25 Jan 2008 13:06:02 -0000 1.219 *************** *** 552,574 **** /** - * Compute the traversed angle of this Surface - * @return The angle - */ - public double angle() { - return angle(coordinateSystem()); - } - - /** - * Compute the traversed angle of this Surface - * @param coordinateSystem The CoordinateSystem - * @return The angle - */ - public double angle(CoordinateSystem coordinateSystem) { - List vertices = getVertices(); - vertices = coordinateSystem.translate(vertices); - return Geometry.angle(vertices); - } - - /** * Get the hole surfaces * @return The hole surfaces --- 552,555 ---- Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** Command.java 22 Jan 2008 13:12:58 -0000 1.65 --- Command.java 25 Jan 2008 13:06:02 -0000 1.66 *************** *** 853,856 **** --- 853,922 ---- Surface bottom = new Surface(edges); Container space = Project.getInstance().getActiveSpace(); + Container union = new Container("Cylinder", Container.CONSTRUCTION, true); + Set<Surface> sides = new HashSet<Surface>(); + Surface top = bottom.extrusion(h, sides); + + union.insert(bottom); + for (Surface surface : sides) { + union.insert(surface); + } + Collection<Edge> visibleEdges = Surface.edges(sides); + visibleEdges.removeAll(top.getEdges()); + visibleEdges.removeAll(bottom.getEdges()); + for (Edge e : visibleEdges) { + e.setSmooth(true); + } + sides.add(top); + sides.add(bottom); + union.insert(top); + + space.add(union); + } + } + + /** + * A command to create a cylinder + */ + public static class Cylinder0 extends Command { + /** + * + */ + public Cylinder0() { + 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 title() { + return "Create Cylinder"; + } + + /** {@inheritDoc}} */ + @Override + public void evaluate() { + double r = parameters.getDouble("radius"); + double h = parameters.getDouble("height"); + int s = (int) parameters.getDouble("slices"); + + 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) * r; + double cos = Math.cos(val) * r; + 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); + Container space = Project.getInstance().getActiveSpace(); Container inside = space.createConstructionSpace("Cylinder"); bottom.setFrontDomain(inside); Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** Geometry.java 24 Jan 2008 10:35:35 -0000 1.70 --- Geometry.java 25 Jan 2008 13:06:02 -0000 1.71 *************** *** 105,156 **** /** - * Calculate the normal that points outwards - * @param vertices The vertices describing a planar polygon - * @return The outwards pointing normal - */ - public static Vertex normal(List vertices) { - Vertex normal = normal0(vertices); - if (normal == null) { - return null; - } - Vertex origin = (Vertex) vertices.get(0); - Vertex a = (Vertex) vertices.get(1); - Vertex i = a.minus(origin); - Vertex j = normal.cross(i); - CoordinateSystem system = new CoordinateSystem(i, j, normal, origin); - List projection = system.translate(vertices); - double tetra = angle(projection); - if (tetra > 0) { - normal.scaleIt(-1); - } - normal.scaleIt(1 / normal.length()); - return normal; - } - - /** - * Calculate some normal vector - * @param vertices The vertices describing a planar polygon - * @return A normal vector - */ - public static Vertex normal0(List vertices) { - if (vertices.size() < 2) { - return null; - } else { - Vertex a = (Vertex) vertices.get(0); - Vertex b = (Vertex) vertices.get(1); - Vertex v1 = b.minus(a); - for (int i = 2; i < vertices.size(); i++) { - Vertex c = (Vertex) vertices.get(i); - Vertex v2 = c.minus(b); - Vertex normal = v1.cross(v2); - if (!normal.isZero()) { - return normal; - } - } - } - return null; - } - - /** * Rotate * @param angle The angle --- 105,108 ---- *************** *** 202,257 **** } - - /** - * Calculate the projection of the vertices into the - * specified plane. - * @param vertices The vertices to project - * @param origin The origin of the plane - * @param normal The normal to the plane - * @return The projection - */ - public static List projection(List vertices, Vertex origin, Vertex normal) { - List projection = new ArrayList(); - - // TODO The following projection calculation should - // be done using a plane. - - for (int i = 0; i < vertices.size(); i++) { - Vertex current = (Vertex) vertices.get(i); - Vertex v = current.minus(origin); - double t = v.dot(normal); - Vertex up = normal.copy(); - up.scaleIt(t); - projection.add(v.minus(up)); - } - return projection; - } - - /** - * Calculate the turn angle of the vertices, which - * are assumed to be 2d (z is ignored). - * @param vertices The vertices to calculate the turn angle for - * @return The turn angle - */ - public static double angle(List vertices) { - Vertex first = (Vertex) vertices.get(0); - Vertex last = (Vertex) vertices.get(vertices.size() - 1); - vertices.add(first); - vertices.add(0, last); - Vertex[] vertexarray = new Vertex[vertices.size()]; - vertices.toArray(vertexarray); - - double tetra = 0.0; - for (int i = 1; i <= (vertexarray.length - 2); i++) { - double dxi = vertexarray[i + 1].getX() - vertexarray[i].getX(); - double dxi1 = vertexarray[i].getX() - vertexarray[i - 1].getX(); - double dyi = vertexarray[i + 1].getY() - vertexarray[i].getY(); - double dyi1 = vertexarray[i].getY() - vertexarray[i - 1].getY(); - double tetrai = Math.atan2((dxi * dyi1 - dxi1 * dyi), (dxi * dxi1 + dyi * dyi1)); - tetra += tetrai; - } - return tetra; - } - /** * Test if exterior contains interior --- 154,157 ---- |
From: Michael L. <he...@us...> - 2008-01-25 13:06:01
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30379/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java PopupMenu.java Log Message: Cylinder Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** Display.java 2 Jan 2008 11:31:09 -0000 1.78 --- Display.java 25 Jan 2008 13:05:58 -0000 1.79 *************** *** 1299,1306 **** private static void draw(Grid grid) { ! Vertex origin = grid.origin(); double size = grid.size(); double delta = grid.delta(); CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); Vertex v = system.getI(); Vertex u = system.getJ(); --- 1299,1307 ---- private static void draw(Grid grid) { ! double size = grid.size(); double delta = grid.delta(); CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); + Vertex origin = system.getOrigin(); Vertex v = system.getI(); Vertex u = system.getJ(); Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PopupMenu.java 24 Jan 2008 10:35:31 -0000 1.15 --- PopupMenu.java 25 Jan 2008 13:05:58 -0000 1.16 *************** *** 559,563 **** union.add(current); } ! for (Geometric current : entities) { current.delete(); } --- 559,563 ---- union.add(current); } ! for (Geometric current : geometrics) { current.delete(); } |
From: Michael L. <he...@us...> - 2008-01-24 10:35:36
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27017/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java SpaceTreeView.java Log Message: make union is more intelligent wrt selection geometry, constraints and globals removed from D-View Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -d -r1.139 -r1.140 *** GenericTreeView.java 10 Jan 2008 09:54:00 -0000 1.139 --- GenericTreeView.java 24 Jan 2008 10:35:38 -0000 1.140 *************** *** 124,128 **** vertexgroupicon = loadIcon("Biconvertexgroup.gif"); genericgroupicon = loadIcon("Bicongenericgroup.gif"); ! constructoricon = loadIcon("Biconconstructor.gif"); constructorgroupicon = loadIcon("Biconconstructorgroup.gif"); constructionspaceicon = loadIcon("Biconconspace.gif"); --- 124,128 ---- vertexgroupicon = loadIcon("Biconvertexgroup.gif"); genericgroupicon = loadIcon("Bicongenericgroup.gif"); ! constructoricon = loadIcon("constructor-icon.png"); constructorgroupicon = loadIcon("Biconconstructorgroup.gif"); constructionspaceicon = loadIcon("Biconconspace.gif"); *************** *** 1170,1181 **** } - /** - * Return icon - * @return icon - */ - public ImageIcon icon() { - return constructorgroupicon; - } - /** {@inheritDoc} */ public EntityNode nodeFor(Object entity) { --- 1170,1173 ---- Index: SpaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpaceTreeView.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** SpaceTreeView.java 10 Dec 2007 18:45:06 -0000 1.29 --- SpaceTreeView.java 24 Jan 2008 10:35:39 -0000 1.30 *************** *** 33,41 **** root.removeAllChildren(); root.add(new ProjectNode(p)); - root.add(new GeometryNode("Geometry", p.world())); - root.add(new ConstraintContainer("Constraints", p.getConstraints())); - root.add(new MaterialContainer("Materials", p.getMaterials(), true)); - root.add(new ParameterBlockNode("Globals", p.getGlobals())); root.add(new ConstructorContainer("Constructors", p.getConstructors())); root.add(new ComponentContainer("Catalog", p.getCatalogObjects())); model.nodeStructureChanged(root); --- 33,38 ---- root.removeAllChildren(); root.add(new ProjectNode(p)); root.add(new ConstructorContainer("Constructors", p.getConstructors())); + root.add(new MaterialContainer("Materials", p.getMaterials(), true)); root.add(new ComponentContainer("Catalog", p.getCatalogObjects())); model.nodeStructureChanged(root); *************** *** 48,66 **** */ public void update() { - long t0 = System.currentTimeMillis(); try { Project p = Project.getInstance(); ((GenericNode)root.getChildAt(0)).update(p); ! ((GenericNode)root.getChildAt(1)).update(p.world()); ! ((GenericNode)root.getChildAt(2)).update(p.getConstraints()); ! ((GenericNode)root.getChildAt(3)).update(p.getMaterials()); ! ((GenericNode)root.getChildAt(4)).update(p.getGlobals()); ! ((GenericNode)root.getChildAt(5)).update(p.getConstructors()); ! ((GenericNode)root.getChildAt(6)).update(p.getCatalogObjects()); } catch (ArrayIndexOutOfBoundsException e) { log.error("There were a inconsistent number of nodes attached to " + "the root which resulted in a exception: " + e.getMessage()); } - long t1 = System.currentTimeMillis(); } } --- 45,58 ---- */ public void update() { try { Project p = Project.getInstance(); ((GenericNode)root.getChildAt(0)).update(p); ! ((GenericNode)root.getChildAt(1)).update(p.getConstructors()); ! ((GenericNode)root.getChildAt(2)).update(p.getMaterials()); ! ((GenericNode)root.getChildAt(3)).update(p.getCatalogObjects()); } catch (ArrayIndexOutOfBoundsException e) { log.error("There were a inconsistent number of nodes attached to " + "the root which resulted in a exception: " + e.getMessage()); } } } |
From: Michael L. <he...@us...> - 2008-01-24 10:35:31
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv27007/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Geometry.java Log Message: make union is more intelligent wrt selection geometry, constraints and globals removed from D-View Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.217 retrieving revision 1.218 diff -C2 -d -r1.217 -r1.218 *** Surface.java 21 Jan 2008 13:37:25 -0000 1.217 --- Surface.java 24 Jan 2008 10:35:35 -0000 1.218 *************** *** 199,203 **** * @return Collection of edges */ ! public static Collection<Edge> edges(Collection<Surface> surfaces) { Set<Edge> edges = new HashSet<Edge>(); for (Surface current : surfaces) { --- 199,203 ---- * @return Collection of edges */ ! public static Set<Edge> edges(Collection<Surface> surfaces) { Set<Edge> edges = new HashSet<Edge>(); for (Surface current : surfaces) { *************** *** 208,211 **** --- 208,240 ---- /** + * Returns set of spaces that are entirely defined by the surfaces + * in collection. + * @param surfaces Collection of surfaces + * @return set of spaces + */ + public static Set<Space> spaces(Collection<Surface> surfaces) { + Set<Space> spaces = new HashSet(); + for (Surface surface : surfaces) { + List<Space> incident = new LinkedList(); + Space front = surface.getFrontDomain(); + Space back = surface.getBackDomain(); + if (!front.isVoid()) { + incident.add(front); + } + if (!(back.isVoid() || (front == back))) { + incident.add(back); + } + + for (Space space : incident) { + if (surfaces.containsAll(space.getEnvelope())) { + spaces.add(space); + } + } + } + return spaces; + } + + + /** * Get the name * @return The name Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** Geometry.java 13 Dec 2007 12:00:30 -0000 1.69 --- Geometry.java 24 Jan 2008 10:35:35 -0000 1.70 *************** *** 892,896 **** Set<Surface> surfaces = first.getSurfaces(); for (Surface s : surfaces) { - int size = s.getEdges().size(); s.replace(extendable, extendedEdge); Container owner = s.getOwner(); --- 892,895 ---- |
From: Michael L. <he...@us...> - 2008-01-24 10:35:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26993/src/net/sourceforge/bprocessor/gl/view Modified Files: PopupMenu.java Log Message: make union is more intelligent wrt selection geometry, constraints and globals removed from D-View Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PopupMenu.java 23 Jan 2008 14:49:29 -0000 1.14 --- PopupMenu.java 24 Jan 2008 10:35:31 -0000 1.15 *************** *** 11,14 **** --- 11,15 ---- import java.util.Collection; import java.util.HashMap; + import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; *************** *** 511,515 **** AbstractAction action = new GeometricMenuAction(arguments, "Make Union") { public void actionPerformed(ActionEvent event) { ! Mesh mesh = new Mesh(entities); HashMap map = new HashMap(); Mesh copy = mesh.copy(map); --- 512,546 ---- AbstractAction action = new GeometricMenuAction(arguments, "Make Union") { public void actionPerformed(ActionEvent event) { ! Collection<Geometric> geometrics = new LinkedList(); ! { ! Set<Space> spaces = new HashSet(); ! Set<Surface> surfaces = new HashSet(); ! Set<Edge> edges = new HashSet(); ! Set<Vertex> vertices = new HashSet(); ! ! for (Geometric current : entities) { ! if (current instanceof Space) { ! spaces.add((Space) current); ! } else if (current instanceof Surface) { ! surfaces.add((Surface) current); ! } else if (current instanceof Edge) { ! edges.add((Edge) current); ! } else if (current instanceof Vertex) { ! vertices.add((Vertex) current); ! } ! } ! spaces.addAll(Surface.spaces(surfaces)); ! for (Space current : spaces) { ! surfaces.addAll(current.getEnvelope()); ! } ! edges.addAll(Surface.edges(surfaces)); ! vertices.addAll(Edge.vertices(edges)); ! geometrics.addAll(spaces); ! geometrics.addAll(surfaces); ! geometrics.addAll(edges); ! geometrics.addAll(vertices); ! } ! ! Mesh mesh = new Mesh(geometrics); HashMap map = new HashMap(); Mesh copy = mesh.copy(map); |
From: Michael L. <he...@us...> - 2008-01-24 10:35:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26993/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectStrategy.java Log Message: make union is more intelligent wrt selection geometry, constraints and globals removed from D-View Index: SelectStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectStrategy.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** SelectStrategy.java 21 Jan 2008 15:12:12 -0000 1.29 --- SelectStrategy.java 24 Jan 2008 10:35:31 -0000 1.30 *************** *** 10,14 **** import java.util.Collection; import java.util.HashSet; - import java.util.LinkedList; import java.util.List; import java.util.Set; --- 10,13 ---- *************** *** 121,125 **** initial = new HashSet(Selection.primary()); } ! private Set<Geometric> extend(Command.Inverse inv, Set<Geometric> geometrics) { Set<Vertex> vertices = new HashSet(); --- 120,124 ---- initial = new HashSet(Selection.primary()); } ! private Set<Geometric> extend(Command.Inverse inv, Set<Geometric> geometrics) { Set<Vertex> vertices = new HashSet(); *************** *** 145,166 **** } ! Set<Space> spaces = new HashSet(); ! for (Surface surface : surfaces) { ! List<Space> incident = new LinkedList(); ! Space front = surface.getFrontDomain(); ! Space back = surface.getBackDomain(); ! if (!front.isVoid()) { ! incident.add(front); ! } ! if (!(back.isVoid() || (front == back))) { ! incident.add(back); ! } ! ! for (Space space : incident) { ! if (surfaces.containsAll(space.getEnvelope())) { ! spaces.add(space); ! } ! } ! } edges.addAll(Surface.edges(surfaces)); --- 144,149 ---- } ! ! Set<Space> spaces = Surface.spaces(surfaces); edges.addAll(Surface.edges(surfaces)); *************** *** 175,178 **** --- 158,162 ---- } + private Set<Geometric> reduce(Command.Inverse inv, Set<Vertex> vertices) { Set<Edge> edges = new HashSet(); *************** *** 196,217 **** } ! Set<Space> spaces = new HashSet(); ! for (Surface surface : surfaces) { ! List<Space> incident = new LinkedList(); ! Space front = surface.getFrontDomain(); ! Space back = surface.getBackDomain(); ! if (!front.isVoid()) { ! incident.add(front); ! } ! if (!(back.isVoid() || (front == back))) { ! incident.add(back); ! } ! ! for (Space space : incident) { ! if (surfaces.containsAll(space.getEnvelope())) { ! spaces.add(space); ! } ! } ! } if (spaces.size() > 0) { --- 180,184 ---- } ! Set<Space> spaces = Surface.spaces(surfaces); if (spaces.size() > 0) { |
From: Michael L. <he...@us...> - 2008-01-23 14:49:36
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16509/src/net/sourceforge/bprocessor/model Modified Files: Space.java Container.java Log Message: edit Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.232 retrieving revision 1.233 diff -C2 -d -r1.232 -r1.233 *** Space.java 18 Jan 2008 14:12:59 -0000 1.232 --- Space.java 23 Jan 2008 14:49:33 -0000 1.233 *************** *** 697,710 **** } - - - /** - * - */ - public void edit() { - Project.getInstance().setActiveSpace((Container) this); - Selection.primary().clear(); - Project.getInstance().changed(Project.getInstance()); - } /** --- 697,700 ---- Index: Container.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Container.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Container.java 22 Jan 2008 13:36:18 -0000 1.13 --- Container.java 23 Jan 2008 14:49:33 -0000 1.14 *************** *** 1503,1505 **** --- 1503,1535 ---- } + /** + * + */ + public void edit() { + int ns = getSurfaces().size(); + + if (ns == 0) { + Collection<Surface> surfaces = new LinkedList(); + Map map = new HashMap(); + for (Surface current : envelope) { + surfaces.add((Surface) current.copy(map)); + } + Collection<Edge> edges = Surface.edges(surfaces); + Collection<Vertex> vertices = Edge.vertices(edges); + for (Vertex current : vertices) { + add(current); + } + for (Edge current : edges) { + add(current); + } + for (Surface current : surfaces) { + add(current); + } + } + + Project.getInstance().setActiveSpace((Container) this); + Selection.primary().clear(); + Project.getInstance().changed(Project.getInstance()); + } + } |
From: Michael L. <he...@us...> - 2008-01-23 14:49:36
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16496/src/net/sourceforge/bprocessor/gl/view Modified Files: PopupMenu.java Log Message: edit Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PopupMenu.java 22 Jan 2008 14:17:48 -0000 1.13 --- PopupMenu.java 23 Jan 2008 14:49:29 -0000 1.14 *************** *** 269,280 **** Container sp = (Container)s.iterator().next(); ! 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); } }; --- 269,275 ---- Container sp = (Container)s.iterator().next(); ! AbstractAction edit = new SpaceMenuAction(sp, "Detail") { public void actionPerformed(ActionEvent arg0) { space.edit(); } }; |
From: Michael L. <he...@us...> - 2008-01-22 14:18:01
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1348/src/net/sourceforge/bprocessor/gl/view Modified Files: PopupMenu.java Log Message: clear/reduce Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PopupMenu.java 22 Jan 2008 13:36:14 -0000 1.12 --- PopupMenu.java 22 Jan 2008 14:17:48 -0000 1.13 *************** *** 280,283 **** --- 280,304 ---- }; menu.add(edit); + { + AbstractAction action = new SpaceMenuAction(sp, "Reduce") { + public void actionPerformed(ActionEvent event) { + space.reduce(); + Project.getInstance().changed(Project.getInstance()); + Project.getInstance().checkpoint(); + } + }; + menu.add(action); + } + { + AbstractAction action = new SpaceMenuAction(sp, "Clear") { + public void actionPerformed(ActionEvent event) { + space.clear(); + Project.getInstance().changed(Project.getInstance()); + Project.getInstance().checkpoint(); + } + }; + menu.add(action); + } + { |
From: Michael L. <he...@us...> - 2008-01-22 13:36:19
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17877/src/net/sourceforge/bprocessor/model Modified Files: Container.java Log Message: reduce Index: Container.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Container.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Container.java 22 Jan 2008 13:12:58 -0000 1.12 --- Container.java 22 Jan 2008 13:36:18 -0000 1.13 *************** *** 1135,1140 **** */ public void reduce() { ! Command.Inverse inv = new Command.Inverse(this); ! inv.reduce(); } --- 1135,1142 ---- */ public void reduce() { ! // Command.Inverse inv = new Command.Inverse(this); ! // inv.reduce(); ! Collection geometrics = mesh().geometrics(); ! Geometry.simplifyGeometry(geometrics); } |
From: Michael L. <he...@us...> - 2008-01-22 13:36:11
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17859/src/net/sourceforge/bprocessor/gl/view Modified Files: PopupMenu.java Log Message: reduce Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PopupMenu.java 22 Jan 2008 13:12:51 -0000 1.11 --- PopupMenu.java 22 Jan 2008 13:36:14 -0000 1.12 *************** *** 760,763 **** --- 760,765 ---- public void actionPerformed(ActionEvent event) { Project.getInstance().world().reduce(); + Project.getInstance().changed(Project.getInstance()); + Project.getInstance().checkpoint(); } }; |
From: Michael L. <he...@us...> - 2008-01-22 13:12:54
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8457/src/net/sourceforge/bprocessor/model Modified Files: Command.java Container.java Log Message: reduce Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** Command.java 21 Jan 2008 15:12:16 -0000 1.64 --- Command.java 22 Jan 2008 13:12:58 -0000 1.65 *************** *** 284,287 **** --- 284,288 ---- */ public static class Inverse { + private Container owner; private Collection<Vertex> vertices; private Collection<Edge> edges; *************** *** 292,296 **** /** ! * Construcs an inverse mapping * * @param surfaces Collection of surfaces --- 293,297 ---- /** ! * Constructs an inverse mapping * * @param surfaces Collection of surfaces *************** *** 327,330 **** --- 328,344 ---- } + /** + * Constructs an inverse mapping for geometry in specified + * space. + * @param container Container + */ + public Inverse(Container container) { + owner = container; + Collection<Surface> surfaces = container.getSurfaces(); + Collection<Edge> edges = container.getEdges(); + Collection<Vertex> vertices = container.getVertices(); + initialize(surfaces, edges, vertices); + } + /** *************** *** 421,424 **** --- 435,518 ---- return v2s.get(vertex); } + + + /** + * Create new edge + * @param from Vertex + * @param to Vertex + * @return Edge + */ + public Edge edge(Vertex from, Vertex to) { + Edge edge = new Edge(from, to); + e2s.put(edge, new LinkedList()); + v2e.get(from).add(edge); + v2e.get(to).add(edge); + owner.add(edge); + return edge; + } + + /** + * Remove edge + * @param edge Edge + */ + public void remove(Edge edge) { + edges.remove(edge); + v2e.get(edge.from).remove(edge); + v2e.get(edge.to).remove(edge); + e2s.remove(edge); + owner.remove(edge); + } + + /** + * Remove vertex + * @param vertex Vertex + */ + public void remove(Vertex vertex) { + vertices.remove(vertex); + v2e.remove(vertex); + owner.remove(vertex); + } + + /** + * Remove unecessary geometry preserving the shape. + * + */ + public void reduce() { + Collection<Vertex> deletion = new LinkedList(); + for (Vertex current : vertices()) { + List<Edge> edges = edges(current); + if (edges.size() == 2) { + Iterator<Edge> iter = edges.iterator(); + Edge e1 = iter.next(); + Edge e2 = iter.next(); + Vertex p = e1.otherVertex(current); + Vertex q = e2.otherVertex(current); + Vertex u = p.minus(current); + Vertex v = q.minus(current); + Vertex cross = u.cross(v); + if (cross.isZero()) { + Edge edge = edge(p, q); + Collection<Surface> es = new LinkedList(surfaces(e1)); + + for (Surface surface : es) { + surface.replace(edges, edge); + e2s.get(edge).add(surface); + for (Edge e : edges) { + e2s.get(e).remove(surface); + } + } + + for (Edge e : new LinkedList<Edge>(edges)) { + remove(e); + } + deletion.add(current); + } + } + } + + for (Vertex current : deletion) { + remove(current); + } + } } Index: Container.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Container.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Container.java 20 Dec 2007 15:36:55 -0000 1.11 --- Container.java 22 Jan 2008 13:12:58 -0000 1.12 *************** *** 1132,1135 **** --- 1132,1143 ---- /** + * Remove vertexes with two parallel edges + */ + public void reduce() { + Command.Inverse inv = new Command.Inverse(this); + inv.reduce(); + } + + /** * Simplify this space * 1) remove equivalent vertexes (vertex at same position) |
From: Michael L. <he...@us...> - 2008-01-22 13:12:50
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8446/src/net/sourceforge/bprocessor/gl/view Modified Files: PopupMenu.java Log Message: reduce Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PopupMenu.java 21 Jan 2008 13:37:21 -0000 1.10 --- PopupMenu.java 22 Jan 2008 13:12:51 -0000 1.11 *************** *** 756,759 **** --- 756,767 ---- menu.add(action); } + { + AbstractAction action = new AbstractAction("Reduce") { + public void actionPerformed(ActionEvent event) { + Project.getInstance().world().reduce(); + } + }; + menu.add(action); + } menu.add(getAnalysisMenu()); return menu; |
From: Michael L. <he...@us...> - 2008-01-21 15:12:12
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29796/src/net/sourceforge/bprocessor/model Modified Files: Command.java Geometric.java Log Message: improved selection logic Index: Geometric.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometric.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Geometric.java 21 Jan 2008 13:37:25 -0000 1.22 --- Geometric.java 21 Jan 2008 15:12:16 -0000 1.23 *************** *** 41,45 **** Command.Inverse inv = null; if (owner != null) { ! inv = new Command.Inverse(new LinkedList(owner.getSurfaces())); } --- 41,45 ---- Command.Inverse inv = null; if (owner != null) { ! inv = new Command.Inverse(owner.mesh()); } Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** Command.java 14 Jan 2008 14:00:27 -0000 1.63 --- Command.java 21 Jan 2008 15:12:16 -0000 1.64 *************** *** 292,295 **** --- 292,308 ---- /** + * Construcs an inverse mapping + * + * @param surfaces Collection of surfaces + * @param edges Collection of edges + * @param vertices Collection of vertices + */ + public Inverse(Collection<Surface> surfaces, + Collection<Edge> edges, + Collection<Vertex> vertices) { + initialize(surfaces, edges, vertices); + } + + /** * Constructs an Inverse object, which makes * it possible to navigate geometry in reverse. *************** *** 297,304 **** * @param surfaces Collection of surfaces */ ! public Inverse(List<Surface> surfaces) { this.surfaces = surfaces; ! edges = Surface.edges(surfaces); ! vertices = Edge.vertices(edges); v2e = new HashMap(); --- 310,343 ---- * @param surfaces Collection of surfaces */ ! public Inverse(Collection<Surface> surfaces) { ! Collection<Edge> edges = Surface.edges(surfaces); ! Collection<Vertex> vertices = Edge.vertices(edges); ! initialize(surfaces, edges, vertices); ! } ! ! /** ! * Constructs this Inverse using objects in the mesh ! * @param mesh Mesh ! */ ! public Inverse(Mesh mesh) { ! Collection<Surface> surfaces = mesh.surfaces(); ! Collection<Edge> edges = mesh.edges(); ! Collection<Vertex> vertices = mesh.vertices(); ! initialize(surfaces, edges, vertices); ! } ! ! ! /** ! * Initializes this Inverse ! * @param surfaces Collection of surfaces ! * @param edges Collection of edges ! * @param vertices Collection of vertices ! */ ! public void initialize(Collection<Surface> surfaces, ! Collection<Edge> edges, ! Collection<Vertex> vertices) { this.surfaces = surfaces; ! this.edges = edges; ! this.vertices = vertices; v2e = new HashMap(); *************** *** 331,335 **** } } - /** * Returns the vertices --- 370,373 ---- |
From: Michael L. <he...@us...> - 2008-01-21 15:12:09
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29778/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectStrategy.java Log Message: improved selection logic Index: SelectStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectStrategy.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** SelectStrategy.java 21 Jan 2008 13:37:21 -0000 1.28 --- SelectStrategy.java 21 Jan 2008 15:12:12 -0000 1.29 *************** *** 257,261 **** Container owner = Project.getInstance().getActiveSpace(); ! Command.Inverse inv = new Command.Inverse(new LinkedList(owner.getSurfaces())); Collection<Geometric> objects; --- 257,261 ---- Container owner = Project.getInstance().getActiveSpace(); ! Command.Inverse inv = new Command.Inverse(owner.mesh()); Collection<Geometric> objects; |
From: Michael L. <he...@us...> - 2008-01-21 13:37:27
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21030/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Surface.java Geometric.java Log Message: Connected geometry Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.216 retrieving revision 1.217 diff -C2 -d -r1.216 -r1.217 *** Surface.java 11 Jan 2008 09:22:08 -0000 1.216 --- Surface.java 21 Jan 2008 13:37:25 -0000 1.217 *************** *** 2122,2124 **** --- 2122,2140 ---- this.setNormals(normals); } + + /** + * {@inheritDoc} + */ + public Collection<Geometric> connected(Command.Inverse inv, boolean all) { + Collection<Geometric> result = super.connected(inv, all); + result.addAll(edges); + if (all) { + if (exterior != null) { + result.add(exterior); + } + result.addAll(getHoles()); + } + return result; + } + } Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** Edge.java 15 Jan 2008 15:43:40 -0000 1.107 --- Edge.java 21 Jan 2008 13:37:25 -0000 1.108 *************** *** 1298,1301 **** --- 1298,1312 ---- return run; } + + /** + * {@inheritDoc} + */ + public Collection<Geometric> connected(Command.Inverse inv, boolean all) { + Collection<Geometric> result = super.connected(inv, all); + result.addAll(inv.surfaces(this)); + result.add(from); + result.add(to); + return result; + } /** Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** Vertex.java 14 Jan 2008 14:00:25 -0000 1.77 --- Vertex.java 21 Jan 2008 13:37:25 -0000 1.78 *************** *** 616,619 **** --- 616,628 ---- /** + * {@inheritDoc} + */ + public Collection<Geometric> connected(Command.Inverse inv, boolean all) { + Collection<Geometric> result = super.connected(inv, all); + result.addAll(inv.edges(this)); + return result; + } + + /** * Info * @param object Object Index: Geometric.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometric.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Geometric.java 13 Dec 2007 12:00:31 -0000 1.21 --- Geometric.java 21 Jan 2008 13:37:25 -0000 1.22 *************** *** 12,15 **** --- 12,16 ---- import java.util.LinkedList; import java.util.Map; + import java.util.Queue; import java.util.Set; /** *************** *** 24,100 **** private boolean protect; /** * Returns collection of all connected geometry of specified * collection of geometric objects. * @param geometrics Collecion of Geometric objects ! * @return all connected geometry */ ! public static Collection<Geometric> connected(Collection<Geometric> geometrics) { ! Set<Geometric> mark = new HashSet(); ! LinkedList<Surface> surfaces = new LinkedList(); ! LinkedList<Edge> edges = new LinkedList(); ! LinkedList<Vertex> vertices = new LinkedList(); ! Set<Surface> env = new HashSet(surfaces); ! for (Geometric current : geometrics) { ! if (current instanceof Surface) { ! surfaces.offer((Surface) current); ! } else if (current instanceof Edge) { ! edges.offer((Edge) current); ! } else if (current instanceof Vertex) { ! vertices.offer((Vertex) current); ! } ! } ! loop: ! while (true) { ! if (!surfaces.isEmpty()) { ! Surface surface = surfaces.remove(); ! mark.add(surface); ! env.add(surface); ! for (Edge current : surface.getEdges()) { ! if (!mark.contains(current)) { ! edges.offer(current); ! } ! } ! for (Surface current : surface.getHoles()) { ! if (!mark.contains(current)) { ! surfaces.offer(current); ! } ! } ! } else if (!edges.isEmpty()) { ! Edge edge = edges.remove(); ! mark.add(edge); ! if (!mark.contains(edge.from)) { ! vertices.offer(edge.from); ! } ! if (!mark.contains(edge.to)) { ! vertices.offer(edge.to); ! } ! for (Surface current : edge.getSurfaces()) { ! if (!mark.contains(current)) { ! surfaces.offer(current); ! } ! } ! } else if (!vertices.isEmpty()) { ! Vertex vertex = vertices.remove(); ! mark.add(vertex); ! for (Edge current : vertex.getEdges()) { ! if (!mark.contains(current)) { ! edges.offer(current); ! } ! } ! } else { ! break loop; ! } } ! ! Set<Container> spaces = new HashSet(); ! for (Surface current : env) { ! spaces.add(current.getFrontDomain()); ! spaces.add(current.getBackDomain()); } ! for (Container current : spaces) { ! if (current != current.getOwner().empty) { ! if (env.containsAll(current.getEnvelope())) { mark.add(current); } } --- 25,55 ---- private boolean protect; + /** * Returns collection of all connected geometry of specified * collection of geometric objects. * @param geometrics Collecion of Geometric objects ! * @param all consider hole/exterior relations as well ! * @return connected geometry */ ! public static Collection<Geometric> connected(Collection<Geometric> geometrics, boolean all) { ! Set<Geometric> mark = new HashSet(geometrics); ! Container owner = null; ! if (geometrics.size() > 0) { ! owner = geometrics.iterator().next().getOwner(); } ! Command.Inverse inv = null; ! if (owner != null) { ! inv = new Command.Inverse(new LinkedList(owner.getSurfaces())); } ! ! Queue<Geometric> queue = new LinkedList(geometrics); ! while (!queue.isEmpty()) { ! Geometric geometric = queue.remove(); ! Collection<Geometric> connected = geometric.connected(inv, all); ! for (Geometric current : connected) { ! if (!mark.contains(current)) { mark.add(current); + queue.add(current); } } *************** *** 196,199 **** --- 151,165 ---- public abstract Vertex center(); + + /** + * Returns the geometric objects that are connected to this geometric object + * @param inv Inverse relations + * @param all consider hole/exterior relations as well + * @return Connected geometric objects + */ + public Collection<Geometric> connected(Command.Inverse inv, boolean all) { + return new LinkedList(); + } + /** * Move the geometric object x,y,z |
From: Michael L. <he...@us...> - 2008-01-21 13:37:24
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21013/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectStrategy.java Log Message: Connected geometry Index: SelectStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectStrategy.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** SelectStrategy.java 16 Jan 2008 15:05:41 -0000 1.27 --- SelectStrategy.java 21 Jan 2008 13:37:21 -0000 1.28 *************** *** 21,27 **** import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; - import net.sourceforge.bprocessor.model.ClippingPlane; import net.sourceforge.bprocessor.model.Command; - import net.sourceforge.bprocessor.model.Constructor; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Geometric; --- 21,25 ---- *************** *** 322,362 **** if (e.getClickCount() >= 2) { if (e.getClickCount() == 2) { ! Collection<Geometric> extended = new HashSet(); ! extended.addAll(Selection.primary()); ! if (extended.isEmpty()) { ! //Move out one space/union level if possible Container sp = Project.getInstance().getActiveSpace(); if (sp.getOwner() != null) { sp.getOwner().edit(); } } - for (Geometric current : Selection.primary()) { - if (current instanceof Edge) { - Edge edge = (Edge) current; - extended.addAll(edge.getSurfaces()); - } else if (current instanceof Surface) { - Surface surface = (Surface) current; - extended.addAll(surface.getEdges()); - } else if (target instanceof Container) { - Container space = (Container) target; - extended.clear(); - space.edit(); - break; - } else if (target instanceof Constructor) { - Constructor c = (Constructor)target; - c.setActive(!c.isActive()); - } else if (target instanceof ClippingPlane) { - ClippingPlane cp = (ClippingPlane)target; - cp.setActive(!cp.isActive()); - } else if (target instanceof GlCamera) { - GlCamera glcam = (GlCamera)target; - Project.getInstance().setCurrentCamera(glcam.getCamera()); - } - } - Selection.primary().clear(); - Selection.primary().addAll(extended); } else { Collection<Geometric> geometrics = ! Geometric.connected(Selection.primary()); Selection.primary().set(geometrics); } --- 320,336 ---- if (e.getClickCount() >= 2) { if (e.getClickCount() == 2) { ! if (selection.isEmpty()) { Container sp = Project.getInstance().getActiveSpace(); if (sp.getOwner() != null) { sp.getOwner().edit(); } + } else { + Collection<Geometric> geometrics = + Geometric.connected(Selection.primary(), false); + Selection.primary().set(geometrics); } } else { Collection<Geometric> geometrics = ! Geometric.connected(Selection.primary(), true); Selection.primary().set(geometrics); } |
From: Michael L. <he...@us...> - 2008-01-21 13:37:24
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21013/src/net/sourceforge/bprocessor/gl/view Modified Files: PopupMenu.java Log Message: Connected geometry Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PopupMenu.java 10 Jan 2008 09:53:56 -0000 1.9 --- PopupMenu.java 21 Jan 2008 13:37:21 -0000 1.10 *************** *** 479,483 **** public void actionPerformed(ActionEvent arg0) { Collection<Geometric> geometrics = ! Geometric.connected(new LinkedList(entities)); Selection.primary().set(geometrics); } --- 479,483 ---- public void actionPerformed(ActionEvent arg0) { Collection<Geometric> geometrics = ! Geometric.connected(new LinkedList(entities), true); Selection.primary().set(geometrics); } |
From: Michael L. <he...@us...> - 2008-01-18 14:12:59
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13490/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: euler characteristic compute Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.231 retrieving revision 1.232 diff -C2 -d -r1.231 -r1.232 *** Space.java 20 Dec 2007 14:19:55 -0000 1.231 --- Space.java 18 Jan 2008 14:12:59 -0000 1.232 *************** *** 423,426 **** --- 423,437 ---- /** + * Returns the Euler Characteristic of the envelope + * @return Euler Characteristic of envelope + */ + public int eulerCharacteristic() { + Collection<Edge> edges = Surface.edges(envelope); + Collection<Vertex> vertices = Edge.vertices(edges); + int euler = vertices.size() - edges.size() + envelope.size(); + return euler; + } + + /** * Notify that this Space has changed * FIXME: Make the change-update mechanism general *************** *** 529,532 **** --- 540,544 ---- } } + res.add(new Attribute("Euler", Double.valueOf(eulerCharacteristic()))); res.add(new Attribute("Description", getDescription())); if (getModellor() != null) { *************** *** 539,542 **** --- 551,555 ---- } } + return res; } |
From: Michael L. <he...@us...> - 2008-01-18 13:37:14
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32255/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractPencil.java Log Message: Comments Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** AbstractPencil.java 30 Dec 2007 23:29:10 -0000 1.106 --- AbstractPencil.java 18 Jan 2008 13:37:10 -0000 1.107 *************** *** 58,63 **** * * As in AbstractTool it is common to implement cleanUp which is called when a tool is exited, to ! * secure nothing is left in some special case when the tool is used next time (REMEMBER TO CALL ! * SUPER IMPL.) * * If some geometry are needed to be drawn in the view for feedback and so on, use the feedback --- 58,62 ---- * * As in AbstractTool it is common to implement cleanUp which is called when a tool is exited, to ! * secure nothing is left in some special case when the tool is used next time. * * If some geometry are needed to be drawn in the view for feedback and so on, use the feedback *************** *** 190,200 **** if (start != null) { Vertex normal; - /*if (Math.abs(n.getZ()) > 0.47) { - normal = new Vertex(0, 0, 1.0); - } else { - Vertex d = Project.getInstance().getCurrentCamera().getDirection(); - d.normalize(); - normal = d; - }*/ normal = Project.getInstance().getActiveCoordinateSystem().getN(); --- 189,192 ---- |
From: Michael L. <he...@us...> - 2008-01-16 15:05:37
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14169/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectStrategy.java Log Message: Select mechanism changed Index: SelectStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectStrategy.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** SelectStrategy.java 16 Jan 2008 14:21:32 -0000 1.26 --- SelectStrategy.java 16 Jan 2008 15:05:41 -0000 1.27 *************** *** 124,127 **** --- 124,179 ---- } + private Set<Geometric> extend(Command.Inverse inv, Set<Geometric> geometrics) { + Set<Vertex> vertices = new HashSet(); + Set<Edge> edges = new HashSet(); + Set<Surface> surfaces = new HashSet(); + + for (Geometric current : geometrics) { + if (current instanceof Vertex) { + vertices.add((Vertex) current); + } else if (current instanceof Edge) { + edges.add((Edge) current); + } else if (current instanceof Surface) { + surfaces.add((Surface) current); + } + } + + for (Vertex current : vertices) { + edges.addAll(inv.edges(current)); + } + + for (Edge current : edges) { + surfaces.addAll(inv.surfaces(current)); + } + + Set<Space> spaces = new HashSet(); + for (Surface surface : surfaces) { + List<Space> incident = new LinkedList(); + Space front = surface.getFrontDomain(); + Space back = surface.getBackDomain(); + if (!front.isVoid()) { + incident.add(front); + } + if (!(back.isVoid() || (front == back))) { + incident.add(back); + } + + for (Space space : incident) { + if (surfaces.containsAll(space.getEnvelope())) { + spaces.add(space); + } + } + } + + edges.addAll(Surface.edges(surfaces)); + vertices.addAll(Edge.vertices(edges)); + + Set<Geometric> result = new HashSet(); + result.addAll(spaces); + result.addAll(surfaces); + result.addAll(edges); + result.addAll(vertices); + return result; + } private Set<Geometric> reduce(Command.Inverse inv, Set<Vertex> vertices) { *************** *** 204,213 **** { ! Set<Vertex> vertices = new HashSet(); ! Set<Edge> edges = new HashSet(); Container owner = Project.getInstance().getActiveSpace(); if (newX > x) { for (Object current : geometrics) { if (current instanceof Vertex) { --- 256,267 ---- { ! Container owner = Project.getInstance().getActiveSpace(); + Command.Inverse inv = new Command.Inverse(new LinkedList(owner.getSurfaces())); + Collection<Geometric> objects; if (newX > x) { + Set<Vertex> vertices = new HashSet(); for (Object current : geometrics) { if (current instanceof Vertex) { *************** *** 218,236 **** } } } else { for (Object current : geometrics) { ! if (current instanceof Edge) { ! Edge edge = (Edge) current; ! if (edge.getOwner() == owner) { ! edges.add(edge); } } } } - Command.Inverse inv = new Command.Inverse(new LinkedList(owner.getSurfaces())); - - Collection<Geometric> objects = reduce(inv, vertices); - if (!e.isShiftDown()) { Selection.primary().set(objects); --- 272,289 ---- } } + objects = reduce(inv, vertices); } else { + Set<Geometric> input = new HashSet(); for (Object current : geometrics) { ! if (current instanceof Geometric) { ! Geometric geometric = (Geometric) current; ! if (geometric.getOwner() == owner) { ! input.add(geometric); } } } + objects = extend(inv, input); } if (!e.isShiftDown()) { Selection.primary().set(objects); |
From: Michael L. <he...@us...> - 2008-01-16 14:21:28
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28414/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectStrategy.java Log Message: selection mechanics updated Index: SelectStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectStrategy.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** SelectStrategy.java 15 Jan 2008 15:43:36 -0000 1.25 --- SelectStrategy.java 16 Jan 2008 14:21:32 -0000 1.26 *************** *** 29,32 **** --- 29,33 ---- import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Container; + import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; *************** *** 123,126 **** --- 124,179 ---- } + + private Set<Geometric> reduce(Command.Inverse inv, Set<Vertex> vertices) { + Set<Edge> edges = new HashSet(); + for (Vertex vertex : vertices) { + List<Edge> incident = inv.edges(vertex); + for (Edge edge : incident) { + if (vertices.contains(edge.otherVertex(vertex))) { + edges.add(edge); + } + } + } + + Set<Surface> surfaces = new HashSet(); + for (Edge edge : edges) { + List<Surface> incident = inv.surfaces(edge); + for (Surface surface : incident) { + if (edges.containsAll(surface.getEdges())) { + surfaces.add(surface); + } + } + } + + Set<Space> spaces = new HashSet(); + for (Surface surface : surfaces) { + List<Space> incident = new LinkedList(); + Space front = surface.getFrontDomain(); + Space back = surface.getBackDomain(); + if (!front.isVoid()) { + incident.add(front); + } + if (!(back.isVoid() || (front == back))) { + incident.add(back); + } + + for (Space space : incident) { + if (surfaces.containsAll(space.getEnvelope())) { + spaces.add(space); + } + } + } + + if (spaces.size() > 0) { + return new HashSet(spaces); + } else if (surfaces.size() > 0) { + return new HashSet(surfaces); + } else if (edges.size() > 0) { + return new HashSet(edges); + } else { + return new HashSet(vertices); + } + } + /** * Invoked when the mouse cursor has been dragged *************** *** 153,157 **** Set<Vertex> vertices = new HashSet(); Set<Edge> edges = new HashSet(); ! Set<Surface> surfaces = new HashSet(); Container owner = Project.getInstance().getActiveSpace(); --- 206,210 ---- Set<Vertex> vertices = new HashSet(); Set<Edge> edges = new HashSet(); ! Container owner = Project.getInstance().getActiveSpace(); *************** *** 178,206 **** Command.Inverse inv = new Command.Inverse(new LinkedList(owner.getSurfaces())); ! for (Vertex current : vertices) { ! List<Edge> adjacent = inv.edges(current); ! for (Edge edge : adjacent) { ! if (vertices.contains(edge.otherVertex(current))) { ! edges.add(edge); ! } ! } ! } ! ! for (Edge current : edges) { ! List<Surface> adjacent = inv.surfaces(current); ! for (Surface surface : adjacent) { ! if (edges.containsAll(surface.getEdges())) { ! surfaces.add(surface); ! } ! } ! } ! ! edges.addAll(Surface.edges(surfaces)); ! vertices.addAll(Edge.vertices(edges)); ! ! Collection<Geometric> objects = new LinkedList(); ! objects.addAll(surfaces); ! objects.addAll(edges); ! objects.addAll(vertices); if (!e.isShiftDown()) { --- 231,235 ---- Command.Inverse inv = new Command.Inverse(new LinkedList(owner.getSurfaces())); ! Collection<Geometric> objects = reduce(inv, vertices); if (!e.isShiftDown()) { *************** *** 217,238 **** } - surfaces.clear(); - edges.clear(); - vertices.clear(); - for (Geometric current : tentative) { - if (current instanceof Surface) { - surfaces.add((Surface) current); - } else if (current instanceof Edge) { - edges.add((Edge) current); - } else if (current instanceof Vertex) { - vertices.add((Vertex) current); - } - } - edges.addAll(Surface.edges(surfaces)); - vertices.addAll(Edge.vertices(edges)); - tentative.clear(); - tentative.addAll(surfaces); - tentative.addAll(edges); - tentative.addAll(vertices); Selection.primary().set(tentative); } --- 246,249 ---- |
From: Michael L. <he...@us...> - 2008-01-15 15:43:42
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15218/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Log Message: new selection impl Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** Edge.java 17 Dec 2007 13:09:16 -0000 1.106 --- Edge.java 15 Jan 2008 15:43:40 -0000 1.107 *************** *** 81,85 **** * @return Collection of vertices in random order */ ! public static Collection<Vertex> vertices(Collection edges) { Set<Vertex> vertices = new HashSet<Vertex>(); Iterator iter = edges.iterator(); --- 81,85 ---- * @return Collection of vertices in random order */ ! public static Set<Vertex> vertices(Collection edges) { Set<Vertex> vertices = new HashSet<Vertex>(); Iterator iter = edges.iterator(); |