bprocessor-commit Mailing List for B-processor (Page 52)
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-09-29 13:06:36
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30594/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java Log Message: drawing lonely vertices and some color adjustments Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Display.java 28 Sep 2007 13:51:03 -0000 1.13 --- Display.java 29 Sep 2007 13:06:39 -0000 1.14 *************** *** 56,60 **** --- 56,63 ---- private static float[] alice = new float[] {0.94f, 0.97f, 1}; private static float[] cornflower = new float[] {100f / 255, 149f / 255, 237f / 255}; + private static float[] babyblue = new float[] {224f / 255, 255f / 255, 255f / 255}; + private static float[] middleblue = new float[] {0.11f, 0.72f, 0.67f, 0.0f}; + private static float[] misty = new float[] {255f / 280, 228f / 280, 225f / 280}; private static byte[] highlight = new byte[128]; *************** *** 86,90 **** byte b3 = (byte) 0x00; for (int i = 0; i < highlight.length; i++) { ! int d = ((int)(i / 4)) % 4; if (d == 0) { --- 89,93 ---- byte b3 = (byte) 0x00; for (int i = 0; i < highlight.length; i++) { ! int d = (i / 4) % 4; if (d == 0) { *************** *** 224,228 **** gl.glNormal3d(n.getX(), n.getY(), n.getZ()); if (front.isVoid()) { ! gl.glColor3fv(cornflower, 0); } else if (front.isConstructionSpace()) { gl.glColor3fv(Defaults.getFrontColor(), 0); --- 227,231 ---- gl.glNormal3d(n.getX(), n.getY(), n.getZ()); if (front.isVoid()) { ! gl.glColor3fv(misty, 0); } else if (front.isConstructionSpace()) { gl.glColor3fv(Defaults.getFrontColor(), 0); *************** *** 239,243 **** gl.glNormal3d(-n.getX(), -n.getY(), -n.getZ()); if (back.isVoid()) { ! gl.glColor3fv(cornflower, 0); } else if (back.isConstructionSpace()) { gl.glColor3fv(Defaults.getFrontColor(), 0); --- 242,246 ---- gl.glNormal3d(-n.getX(), -n.getY(), -n.getZ()); if (back.isVoid()) { ! gl.glColor3fv(misty, 0); } else if (back.isConstructionSpace()) { gl.glColor3fv(Defaults.getFrontColor(), 0); *************** *** 278,281 **** --- 281,285 ---- private static void drawEdges(Collection<Edge> edges, boolean active) { + Collection<Edge> stippled = new LinkedList(); if (active) { gl.glColor3fv(black, 0); *************** *** 285,289 **** gl.glLineWidth(1.0f); for (Edge current : edges) { ! draw(current); } } --- 289,305 ---- gl.glLineWidth(1.0f); for (Edge current : edges) { ! if (current.getStrippled()) { ! stippled.add(current); ! } else { ! draw(current); ! } ! } ! if (!stippled.isEmpty()) { ! gl.glColor3fv(middleblue, 0); ! gl.glEnable(GL.GL_LINE_STIPPLE); ! for (Edge current : stippled) { ! draw(current); ! } ! gl.glDisable(GL.GL_LINE_STIPPLE); } } *************** *** 377,383 **** Collection<Edge> edges = new LinkedList(); Collection<Vertex> vertices = new LinkedList(); - Collection<Vertex> loners = new LinkedList(); - - for (Space current : space.getElements()) { --- 393,396 ---- *************** *** 427,439 **** } } { ! Set<Vertex> visible = new HashSet(); ! for (Edge current : edges) { ! visible.add(current.getFrom()); ! visible.add(current.getTo()); } ! for (Vertex current : visible) { ! if (!hidden.contains(current)) { ! vertices.add(current); } } --- 440,469 ---- } } + { ! if (selecting()) { ! Set<Vertex> visible = new HashSet(); ! for (Edge current : edges) { ! visible.add(current.getFrom()); ! visible.add(current.getTo()); ! } ! for (Vertex current : visible) { ! if (!hidden.contains(current)) { ! vertices.add(current); ! } ! } } ! ! // FIXME: The set of lonely vertices should be cached. ! Set<Vertex> mark = new HashSet(); ! for (Edge current : space.getEdges()) { ! mark.add(current.getFrom()); ! mark.add(current.getTo()); ! } ! for (Vertex current : space.getVertices()) { ! if (!mark.contains(current)) { ! if (!hidden.contains(current)) { ! vertices.add(current); ! } } } *************** *** 465,469 **** selectVertices(vertices); } else { ! drawVertices(loners); } --- 495,499 ---- selectVertices(vertices); } else { ! drawVertices(vertices); } |
From: rimestad <rim...@us...> - 2007-09-28 14:08:58
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22996/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Added knowledge to isVertexBounded Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.183 retrieving revision 1.184 diff -C2 -d -r1.183 -r1.184 *** Surface.java 27 Sep 2007 13:22:25 -0000 1.183 --- Surface.java 28 Sep 2007 14:09:00 -0000 1.184 *************** *** 1281,1284 **** --- 1281,1290 ---- } } + //The vertex is part of another surface coplaner with this + for (Surface s : vertex.getSurfaces()) { + if (s != this && plane.contains(s)) { + return true; + } + } return false; case 2: *************** *** 1286,1295 **** for (Surface s : vertex.getSurfaces()) { if (this != s) { ! return false; } } break; default: ! break; } --- 1292,1313 ---- for (Surface s : vertex.getSurfaces()) { if (this != s) { ! return true; } } break; + case 1: + return true; default: ! // there are more than three edges connected to this edge ! // if they are all all parallel bound it else dont ! connected.removeAll(this.getEdges()); ! if (connected.size() == 2) { ! Iterator<Edge> iter = connected.iterator(); ! Edge e1 = iter.next(); ! Edge e2 = iter.next(); ! if (e1.parrallel(e2)) { ! return false; ! } ! } break; } |
From: rimestad <rim...@us...> - 2007-09-28 14:08:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22960/src/net/sourceforge/bprocessor/gl/tool Modified Files: ControlledExtrudeTool.java Log Message: Minor changes to controlled extrude Index: ControlledExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledExtrudeTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ControlledExtrudeTool.java 27 Sep 2007 12:20:22 -0000 1.4 --- ControlledExtrudeTool.java 28 Sep 2007 14:08:21 -0000 1.5 *************** *** 77,94 **** @Override protected void moved(MouseEvent e) { findTarget(e, View.HANDLES); if (pressedSurface == null) { if (target instanceof Surface) { glv.getView().makeTarget(target); } } else { ! double x = e.getX(); ! double y = View.getHeight() - e.getY(); ! ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! Transformation transformation = glv.getView().transformation(); ! ray = transformation.unProject(ray); Vertex hit = dragPlane.intersection(ray); current = new Intersection(hit.minus(start.vertex()).projectOnto(normal).add(start.vertex()), --- 77,99 ---- @Override protected void moved(MouseEvent e) { + glv.getView().makeTarget(null); findTarget(e, View.HANDLES); + double x = e.getX(); + double y = View.getHeight() - e.getY(); + Vertex near = new Vertex(x, y, 0.0); + Vertex far = new Vertex(x, y, 1.0); + Edge ray = new Edge(near, far); + Transformation transformation = glv.getView().transformation(); + ray = transformation.unProject(ray); + if (pressedSurface == null) { + // If the extrusion havn't started yet if (target instanceof Surface) { glv.getView().makeTarget(target); + current = new Intersection(((Surface)target).intersection(ray), + Intersection.SURFACE, target); } } else { ! // The extrusion is started Vertex hit = dragPlane.intersection(ray); current = new Intersection(hit.minus(start.vertex()).projectOnto(normal).add(start.vertex()), *************** *** 97,103 **** Plane p = null; if (target instanceof Surface && !affected.contains(target)) { ! p = ((Surface)target).plane(); ! if (Math.abs((Math.abs(p.normal().angle(normal)) - Math.PI / 2)) < 0.01) { ! p = null; } } --- 102,108 ---- Plane p = null; if (target instanceof Surface && !affected.contains(target)) { ! Surface s = (Surface)target; ! if (Math.abs((Math.abs(s.normal().angle(normal)) - Math.PI / 2)) >= 0.05) { ! p = new Plane(normal.projectOnto(s.normal()), s.getFirstVertex()); } } *************** *** 107,111 **** if (v2dir.isEmpty()) { ! // If the extrusion isn't started start it Vertex delta = current.vertex().minus(start.vertex()); double length = delta.length(); --- 112,116 ---- if (v2dir.isEmpty()) { ! // If the extrusion isn't generated generate it Vertex delta = current.vertex().minus(start.vertex()); double length = delta.length(); *************** *** 114,121 **** } - Collection feed = new ArrayList(); - feed.add(new Edge(start.vertex(), start.vertex().add(normal))); - feedback(feed); - Surface topSurface = pressedSurface.extrusionControlled(length, extrusion, v2dir); if (topSurface != pressedSurface) { --- 119,122 ---- *************** *** 139,143 **** } } else { ! //there is a extrusion move it to the apropiate location extrudeTo(p); } --- 140,144 ---- } } else { ! //the extrusion is generated move it to the correct location extrudeTo(p); } *************** *** 147,162 **** private void extrudeTo(Plane p) { double dist = p.distance(start.vertex()) * -1; ! if (dist <= minExtrude) { p.moveDelta(dist - minExtrude); } ! if (dist >= maxExtrude) { p.moveDelta(dist - maxExtrude); } ! current.vertex().set(p.intersection(start.vertex(), normal, true)); for (Vertex v : v2dir.keySet()) { Direction d = v2dir.get(v); Vertex intersection = p.intersection(d.getVertex(), d.getDirection(), true); ! d.getVertex().set(intersection); } updateLength(); --- 148,169 ---- private void extrudeTo(Plane p) { double dist = p.distance(start.vertex()) * -1; ! if (dist < minExtrude) { p.moveDelta(dist - minExtrude); } ! if (dist > maxExtrude) { p.moveDelta(dist - maxExtrude); } ! if (dist != 0) { ! current.vertex().set(p.intersection(start.vertex(), normal, true)); ! } else { ! current.vertex().set(start.vertex()); ! } for (Vertex v : v2dir.keySet()) { Direction d = v2dir.get(v); Vertex intersection = p.intersection(d.getVertex(), d.getDirection(), true); ! if (intersection != null) { ! d.getVertex().set(intersection); ! } } updateLength(); *************** *** 166,170 **** @Override protected void pressed(MouseEvent e) { ! current = findIntersection(e); if (v2dir.isEmpty() && target != null && target instanceof Surface) { active = true; --- 173,177 ---- @Override protected void pressed(MouseEvent e) { ! //current = findIntersection(e); if (v2dir.isEmpty() && target != null && target instanceof Surface) { active = true; *************** *** 194,198 **** Space owner = Project.getInstance().getActiveSpace(); owner.removeProtected(extrusion); ! if (pressedSurface != null && !start.vertex().minus(current.vertex()).isZero()) { excluded(new ArrayList()); Mesh m = new Mesh(extrusion); --- 201,206 ---- Space owner = Project.getInstance().getActiveSpace(); owner.removeProtected(extrusion); ! if (pressedSurface != null && ! !start.vertex().minus(current.vertex()).projectOnto(normal).isZero()) { excluded(new ArrayList()); Mesh m = new Mesh(extrusion); *************** *** 220,225 **** public void escape() { if (pressedSurface != null) { ! extrudeTo(new Plane(normal.getX(), normal.getY(), normal.getZ(), start.vertex())); ! Project.getInstance().getActiveSpace().removeProtected(extrusion); } cleanUp(); --- 228,232 ---- public void escape() { if (pressedSurface != null) { ! Project.getInstance().resetState(); } cleanUp(); *************** *** 234,237 **** --- 241,245 ---- v2dir.clear(); pressedSurface = null; + dragPlane = null; normal = null; active = false; |
From: rimestad <rim...@us...> - 2007-09-28 14:07:34
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22548/src/net/sourceforge/bprocessor/model Modified Files: SurfaceAnalysis.java Log Message: possible null pointer Index: SurfaceAnalysis.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceAnalysis.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SurfaceAnalysis.java 27 Aug 2007 13:39:01 -0000 1.11 --- SurfaceAnalysis.java 28 Sep 2007 14:07:32 -0000 1.12 *************** *** 446,451 **** edges = sorter.sort(edges); { ! EdgeNode previous = edges.get(edges.size() - 1); for (EdgeNode current : edges) { if (previous.to == this) { previous.toSucc = current; --- 446,454 ---- edges = sorter.sort(edges); { ! EdgeNode previous = null; for (EdgeNode current : edges) { + if (previous == null) { + previous = edges.get(edges.size() - 1); + } if (previous.to == this) { previous.toSucc = current; |
From: rimestad <rim...@us...> - 2007-09-28 14:07:00
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22153/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: Made some improvements on simplify to split edges at new vertex crossings Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.177 retrieving revision 1.178 diff -C2 -d -r1.177 -r1.178 *** Space.java 27 Sep 2007 12:20:27 -0000 1.177 --- Space.java 28 Sep 2007 14:06:45 -0000 1.178 *************** *** 160,163 **** --- 160,166 ---- if (fl != null) { fl.add(current); + } else { + log.error(from + " werent in the space but were part of edge " + current + + " in space " + this); } Vertex to = current.getTo(); *************** *** 2674,2677 **** --- 2677,2685 ---- /** * Simplify this space + * 1) remove equivalent vertexes (vertex at same position) + * 2) split edges at vertex crossings + * 2) remove edges of length 0 + * 3) remove equivalent edges (edges with same vertexes) + * 4) remove invalid surfaces */ public void simplify() { *************** *** 2710,2713 **** --- 2718,2722 ---- Collection<Collection<Vertex>> equivalences = new LinkedList(); { + //Remove eqivalent vertexes Vertex leader = null; Collection<Vertex> equivalence = null; *************** *** 2763,2766 **** --- 2772,2787 ---- } { + //split edges at coinciding vertices + for (Vertex v : getVertices()) { + for (Edge e : getEdges()) { + if (e.coincides(v)) { + e.split(v); + break; + } + } + } + } + { + //remove edges of length 0 Map<Edge, Collection<Surface>> surfacemap = new HashMap(); for (Edge edge : getEdges()) { *************** *** 2774,2777 **** --- 2795,2799 ---- Collection<Edge> deletion = new LinkedList(); Set<Surface> empties = new HashSet(); + Collection<Surface> affected = new HashSet<Surface>(); for (Edge current : getEdges()) { if (current.from == current.to) { *************** *** 2794,2797 **** --- 2816,2821 ---- } { + // collapse overlaying edges into one, check if resulting surfaces + // remove surfaces that share all edges so that there are only one left Map<Vertex, List<Edge>> edgemap = new HashMap(); for (Vertex current : getVertices()) { |
From: rimestad <rim...@us...> - 2007-09-28 14:05:07
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21230/src/net/sourceforge/bprocessor/model Modified Files: Plane.java Log Message: new constructor for plane Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Plane.java 27 Sep 2007 10:43:38 -0000 1.30 --- Plane.java 28 Sep 2007 14:04:58 -0000 1.31 *************** *** 75,78 **** --- 75,87 ---- /** + * Constructor for Plane + * @param n the plane normal + * @param v a point in the plane + */ + public Plane(Vertex n, Vertex v) { + this(n.getX(), n.getY(), n.getZ(), v); + } + + /** * Return a doublearray {a,b,c,d} * @return The array |
From: Michael L. <he...@us...> - 2007-09-28 13:51:09
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15214/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java Log Message: Grid drawing experiment Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Display.java 25 Sep 2007 13:45:02 -0000 1.12 --- Display.java 28 Sep 2007 13:51:03 -0000 1.13 *************** *** 103,106 **** --- 103,147 ---- } + + private static class Grid { + private Vertex origin; + private double size; + private double delta; + + /** + * + * + */ + public Grid() { + origin = new Vertex(0, 0, 0); + size = 100.0; + delta = 2.0; + } + + /** + * + * @return origin + */ + public Vertex origin() { + return origin; + } + + /** + * + * @return size + */ + public double size() { + return size; + } + + /** + * + * @return delta + */ + public double delta() { + return delta; + } + } + private static class TesselatorCallback extends GLUtessellatorCallbackAdapter { *************** *** 411,414 **** --- 452,460 ---- drawSurfaces(surfaces); } + if (project.getActiveSpace() == space) { + gl.glDepthMask(false); + draw(new Grid()); + gl.glDepthMask(true); + } drawEdges(edges, active); } *************** *** 463,466 **** --- 509,541 ---- } + private static void draw(Grid grid) { + Vertex origin = grid.origin(); + double size = grid.size(); + double delta = grid.delta(); + + gl.glColor3fv(grey, 0); + gl.glLineWidth(1.0f); + { + double x = origin.getX() - size / 2; + double y = origin.getY(); + double z = origin.getY(); + gl.glBegin(GL.GL_LINE_STRIP); + gl.glVertex3d(x, y, z); + gl.glVertex3d(x + size, y, z); + gl.glEnd(); + } + + { + double x = origin.getX(); + double y = origin.getY() - size / 2; + double z = origin.getY(); + gl.glBegin(GL.GL_LINE_STRIP); + gl.glVertex3d(x, y, z); + gl.glVertex3d(x, y + size, z); + gl.glEnd(); + } + } + + /** * |
From: Michael L. <he...@us...> - 2007-09-27 13:22:25
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12156/src/net/sourceforge/bprocessor/model Modified Files: SpaceAnalysis.java Surface.java Log Message: Improved space propagation Index: SpaceAnalysis.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SpaceAnalysis.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SpaceAnalysis.java 27 Sep 2007 10:44:14 -0000 1.5 --- SpaceAnalysis.java 27 Sep 2007 13:22:25 -0000 1.6 *************** *** 98,116 **** if (surfaces.size() > 1) { Surface selected = select(current, surfaces, surface, side); ! if (!mark.contains(selected)) { ! if (travel(surface, current) == travel(selected, current)) { ! if (side == 1) { ! selected.setBackDomain(surface.getFrontDomain()); ! } else { ! selected.setFrontDomain(surface.getBackDomain()); ! } ! queue.offer(new Element(selected, -side)); ! } else { ! if (side == 1) { ! selected.setFrontDomain(surface.getFrontDomain()); } else { ! selected.setBackDomain(surface.getBackDomain()); } - queue.offer(new Element(selected, side)); } } --- 98,118 ---- if (surfaces.size() > 1) { Surface selected = select(current, surfaces, surface, side); ! if (selected != null) { ! if (!mark.contains(selected)) { ! if (travel(surface, current) == travel(selected, current)) { ! if (side == 1) { ! selected.setBackDomain(surface.getFrontDomain()); ! } else { ! selected.setFrontDomain(surface.getBackDomain()); ! } ! queue.offer(new Element(selected, -side)); } else { ! if (side == 1) { ! selected.setFrontDomain(surface.getFrontDomain()); ! } else { ! selected.setBackDomain(surface.getBackDomain()); ! } ! queue.offer(new Element(selected, side)); } } } *************** *** 151,159 **** } } } } return selected; } - - } --- 153,190 ---- } } + Surface exterior = selected.getExterior(); + if (exterior != null) { + if (angle > Math.PI) { + angle = angle - Math.PI; + } else { + angle = angle + Math.PI; + } + if (side < 0) { + if (angle > maximum) { + selected = null; + maximum = angle; + } + } else { + if (angle < minimum) { + selected = null; + minimum = angle; + } + } + } + } + } + Surface exterior = leader.getExterior(); + if (exterior != null) { + if (side < 0) { + if (Math.PI > maximum) { + selected = null; + } + } else { + if (Math.PI < minimum) { + selected = null; + } } } return selected; } } Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.182 retrieving revision 1.183 diff -C2 -d -r1.182 -r1.183 *** Surface.java 27 Sep 2007 10:47:09 -0000 1.182 --- Surface.java 27 Sep 2007 13:22:25 -0000 1.183 *************** *** 35,39 **** */ public class Surface extends Geometric implements Parametric { ! private static final long serialVersionUID = 1L; private static Logger log = Logger.getLogger(Surface.class); --- 35,39 ---- */ public class Surface extends Geometric implements Parametric { ! private static final boolean AUTOMATIC = false; private static Logger log = Logger.getLogger(Surface.class); *************** *** 685,690 **** // FIXME should return the sides instead of assigning // spaces here. ! assignSpaceForExtrusion(delta, n, facemap, top); ! return top; } --- 685,691 ---- // FIXME should return the sides instead of assigning // spaces here. ! if (AUTOMATIC) { ! assignSpaceForExtrusion(delta, n, facemap, top); ! } return top; } *************** *** 1479,1484 **** public void assignBack(Space back) { setBackDomain(back); ! SpaceAnalysis analysis = new SpaceAnalysis(); ! analysis.propagate(this, -1); } --- 1480,1487 ---- public void assignBack(Space back) { setBackDomain(back); ! if (!AUTOMATIC) { ! SpaceAnalysis analysis = new SpaceAnalysis(); ! analysis.propagate(this, -1); ! } } *************** *** 1504,1509 **** public void assignFront(Space front) { setFrontDomain(front); ! SpaceAnalysis analysis = new SpaceAnalysis(); ! analysis.propagate(this, 1); } --- 1507,1514 ---- public void assignFront(Space front) { setFrontDomain(front); ! if (!AUTOMATIC) { ! SpaceAnalysis analysis = new SpaceAnalysis(); ! analysis.propagate(this, 1); ! } } |
From: rimestad <rim...@us...> - 2007-09-27 12:20:27
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19579/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: Added automation to remove one surface if two have the same edge list. Made controlled extrude extrude to the boundary and not just close to it Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.176 retrieving revision 1.177 diff -C2 -d -r1.176 -r1.177 *** Space.java 27 Sep 2007 10:44:51 -0000 1.176 --- Space.java 27 Sep 2007 12:20:27 -0000 1.177 *************** *** 2837,2842 **** --- 2837,2844 ---- } } + Collection<Edge> remaining = new HashSet<Edge>(); for (Collection<Edge> equivalence : equivalences) { Edge leader = equivalence.iterator().next(); + remaining.add(leader); for (Edge current : equivalence) { if (leader != current) { *************** *** 2845,2852 **** --- 2847,2873 ---- surface.replace(current, leader); } + remaining.remove(current); remove(current); } } } + for (Edge e : remaining) { + Collection<Surface> delete = new HashSet<Surface>(); + for (Surface s1 : e.getSurfaces()) { + for (Surface s2 : e.getSurfaces()) { + if (s1 != s2 && !(delete.contains(s1) || delete.contains(s2)) + && s1.getEdges().containsAll(s2.getEdges())) { + if (s1.id < s2.id) { + delete.add(s2); + } else { + delete.add(s1); + } + } + } + } + for (Surface s : delete) { + remove(s); + } + } } Project.getInstance().changed(Project.getInstance()); |
From: rimestad <rim...@us...> - 2007-09-27 12:20:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19559/src/net/sourceforge/bprocessor/gl/tool Modified Files: ControlledExtrudeTool.java Log Message: Added automation to remove one surface if two have the same edge list. Made controlled extrude extrude to the boundary and not just close to it Index: ControlledExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledExtrudeTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ControlledExtrudeTool.java 27 Sep 2007 10:49:17 -0000 1.3 --- ControlledExtrudeTool.java 27 Sep 2007 12:20:22 -0000 1.4 *************** *** 147,154 **** private void extrudeTo(Plane p) { double dist = p.distance(start.vertex()) * -1; ! if (dist < minExtrude) { p.moveDelta(dist - minExtrude); } ! if (dist > maxExtrude) { p.moveDelta(dist - maxExtrude); } --- 147,154 ---- private void extrudeTo(Plane p) { double dist = p.distance(start.vertex()) * -1; ! if (dist <= minExtrude) { p.moveDelta(dist - minExtrude); } ! if (dist >= maxExtrude) { p.moveDelta(dist - maxExtrude); } *************** *** 198,201 **** --- 198,204 ---- Mesh m = new Mesh(extrusion); owner.insert(m); + if (extrusion.isEmpty()) { + owner.simplify(); + } owner.changed(); Project.getInstance().checkpoint(); |
From: rimestad <rim...@us...> - 2007-09-27 10:50:17
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15123/src/net/sourceforge/bprocessor/gl/tool Modified Files: OffsetTool.java Log Message: Made som visual feedback and a changed structur for extrusion Index: OffsetTool.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/OffsetTool.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** OffsetTool.java 20 Sep 2007 07:45:06 -0000 1.17 --- OffsetTool.java 27 Sep 2007 10:50:16 -0000 1.18 *************** *** 12,17 **** import java.awt.event.MouseEvent; import java.util.Collection; ! import java.util.Iterator; import java.util.List; import java.util.LinkedList; --- 12,18 ---- import java.awt.event.MouseEvent; + import java.util.ArrayList; import java.util.Collection; ! import java.util.HashSet; import java.util.List; import java.util.LinkedList; *************** *** 21,26 **** --- 22,29 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.Intersection; + import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Direction; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Point; *************** *** 39,52 **** /** The current contour */ ! private List contour; /** A map of wich direction each vertex should be moved */ ! private Map directionMap; ! ! /** The last point the offset was moved to */ ! private Vertex lastOffsetPoint; ! ! /** Tells if a surface is found to do the offset from */ ! private boolean surfaceFound; /** A vector perpendicular to both the edge clicked to start the offset, --- 42,49 ---- /** The current contour */ ! private List<Edge> contour; /** A map of wich direction each vertex should be moved */ ! private Map<Vertex, Direction> directionMap; /** A vector perpendicular to both the edge clicked to start the offset, *************** *** 61,64 **** --- 58,69 ---- private Edge edge; + private CoordinateSystem offsetCoord; + + private Surface offsetSurface; + + private LinkedList<Edge> finalEdgeList; + + private Edge guide; + /** * Constructor fo OffsetTool *************** *** 68,74 **** public OffsetTool(GLView glv, Cursor cursor) { super(glv, cursor); ! contour = new LinkedList(); directionMap = new HashMap(); - surfaceFound = false; dragging = false; outNormal = null; --- 73,81 ---- public OffsetTool(GLView glv, Cursor cursor) { super(glv, cursor); ! guide = new Edge(new Vertex(0, 0, 0), new Vertex(0, 0, 0)); ! guide.setStrippled(true); ! contour = new LinkedList<Edge>(); ! finalEdgeList = new LinkedList<Edge>(); directionMap = new HashMap(); dragging = false; outNormal = null; *************** *** 78,138 **** /** - * * Update feedback */ ! public void updateFeedback() { ! if (start != null && lastOffsetPoint != null) { ! if (!surfaceFound) { ! Edge startEdge = (Edge)start.object(); ! if (current != null && ! current.object() instanceof Surface && ! ((Surface)current.object()).contains(startEdge)) { ! surfaceFound = true; ! Surface surface = (Surface)current.object(); ! List<Edge> edges = new LinkedList<Edge>(); ! edges.addAll(surface.getEdges()); ! Collection selection = Selection.primary(); ! if (selection.size() > 0 && edges.containsAll(selection)) { ! log.info("Did contain all"); ! edges.clear(); ! edges.addAll(selection); ! } ! directionMap = new HashMap(); ! contour.addAll(Edge.offset(edges, surface, ! -(current.vertex().minus(start.vertex()).length()), directionMap)); ! feedback(contour); ! outNormal = startEdge.getDirection().cross(surface.normal()); ! outNormal.scale(1 / outNormal.length()); ! if (current.vertex().minus(start.vertex()).dot(outNormal) > 0) { ! outNormal.scale(1 / outNormal.length()); ! } else { ! outNormal.scale(-1 / outNormal.length()); ! } ! } ! lastOffsetPoint = current.vertex().copy(); } else { ! Vertex projection = outNormal.copy(); ! projection.scale((lastOffsetPoint.minus(current.vertex())).dot(projection)); ! double length; ! if (projection.dot(outNormal) > 0) { ! length = projection.length(); ! } else { ! length = -projection.length(); } - moveContour(length); - lastOffsetPoint = current.vertex().copy(); - } - } - if (start == null && current.object() instanceof Surface) { - Surface s = (Surface)current.object(); - if (Selection.primary().isEmpty()) { - edge = s.findClosestEdge(current.vertex(), s.getEdges()); - } else { - edge = s.findClosestEdge(current.vertex(), Selection.primary()); } if (edge != null) { glv.setCursor(this.getCursor()); edgePoint = edge.intersection(current.vertex()); ! LinkedList feedback = new LinkedList(); feedback.add(new Point(edgePoint)); feedback(feedback); --- 85,125 ---- /** * Update feedback */ ! private void updateFeedback() { ! if (start == null) { ! if (!finalEdgeList.isEmpty()) { ! //find closest edge in selection ! edge = findClosestEdge(current.vertex(), finalEdgeList); } else { ! //look at the current object ! if (target instanceof Surface) { ! offsetSurface = (Surface)target; ! lockingPlane = offsetSurface.plane(); ! lock = true; ! } ! if (offsetSurface != null) { ! offsetCoord = offsetSurface.coordinateSystem(); ! edge = findClosestEdge(current.vertex(), offsetSurface.getEdges()); } } if (edge != null) { glv.setCursor(this.getCursor()); edgePoint = edge.intersection(current.vertex()); ! Vertex dir = edge.getDirection(); ! outNormal = dir.cross(offsetCoord.getN()); ! outNormal.normalize(); ! if (offsetSurface != null && current != null) { ! if (offsetSurface.surrounds(current.vertex())) { ! if (outNormal.dot(current.vertex().minus(edgePoint)) > 0) { ! outNormal.scale(-1); ! } ! } else { ! if (outNormal.dot(current.vertex().minus(edgePoint)) < 0) { ! outNormal.scale(-1); ! } ! } ! } ! LinkedList<Geometric> feedback = new LinkedList<Geometric>(); feedback.add(new Point(edgePoint)); feedback(feedback); *************** *** 143,146 **** --- 130,163 ---- current = null; } + } else { + Vertex delta = current.vertex().minus(start.vertex()); + double length = delta.length(); + double dot = delta.dot(outNormal); + if (dot < 0) { + length *= -1; + } + if (contour.isEmpty()) { + if (finalEdgeList.isEmpty()) { + contour = Edge.offset(offsetSurface.getEdges(), offsetCoord, length, directionMap); + } else { + Collection<Edge> edges = finalEdgeList; + contour = Edge.offset(edges, offsetCoord, length, directionMap); + } + Collection<Edge> feedback = new ArrayList<Edge>(contour.size() + 1); + feedback.addAll(contour); + feedback.add(guide); + feedback(feedback); + } else { + // Just use the keys to offset it + for (Vertex origin : directionMap.keySet()) { + Direction d = directionMap.get(origin); + Vertex moveDelta = d.getDirection().copy(); + moveDelta.scale(length); + Vertex to = origin.add(moveDelta); + d.getVertex().set(to); + } + } + guide.setFrom(start.vertex()); + guide.setTo(current.vertex()); } updateLength(); *************** *** 149,152 **** --- 166,186 ---- } + private Edge findClosestEdge(Vertex vertex, Collection<Edge> edges) { + // TODO Auto-generated method stub + double minLength = Double.MAX_VALUE; + Edge closestEdge = null; + for (Geometric g : edges) { + Edge e = (Edge)g; + Vertex intersection = e.intersection(vertex); + Vertex v = intersection.minus(vertex); + double dist = v.length(); + if (e.coincides(intersection) && dist < minLength) { + closestEdge = e; + minLength = dist; + } + } + return closestEdge; + } + /** * Tip when the selection is wrong *************** *** 157,175 **** } - /** - * Moves the offset contour by the sepcified length - * @param length the length to move the offset - */ - private void moveContour(double length) { - Iterator it = directionMap.values().iterator(); - while (it.hasNext()) { - Direction d = (Direction)it.next(); - Vertex dir; - dir = d.getDirection().copy(); - dir.scale(length); - d.getVertex().move(dir.getX(), dir.getY(), dir.getZ()); - } - } - /** * Invoked when the mouse cursor has been moved --- 191,194 ---- *************** *** 178,185 **** @Override protected void moved(MouseEvent e) { ! current = findIntersection(e); ! if (current != null) { ! updateFeedback(); } } --- 197,208 ---- @Override protected void moved(MouseEvent e) { ! current = findIntersection(e); ! findTarget(e); ! if (outNormal != null && start != null) { ! Vertex v = ! (new Edge(start.vertex(), start.vertex().add(outNormal)).intersection(current.vertex())); ! current = new Intersection(v, Intersection.PLANE_INTERSECTION, null); } + updateFeedback(); } *************** *** 189,202 **** */ protected void pressed(MouseEvent e) { ! if (start == null) { if (current != null) { ! if (current.object() instanceof Edge) { ! start = current; ! lastOffsetPoint = start.vertex().copy(); ! } else if (current.object() instanceof Surface) { ! start = new Intersection(edgePoint, Intersection.EDGE, edge); ! lastOffsetPoint = current.vertex().copy(); ! } setTip(secondClickTip()); } } else { --- 212,220 ---- */ protected void pressed(MouseEvent e) { ! if (start == null && edge != null) { if (current != null) { ! start = new Intersection(edgePoint, Intersection.EDGE, edge); setTip(secondClickTip()); + updateFeedback(); } } else { *************** *** 209,214 **** */ public void onVertex() { ! if (start != null && current != null && lastOffsetPoint != null) { ! Vertex lengthVector = start.vertex().minus(current.vertex()); Vertex projection = outNormal.copy(); projection.scale(start.vertex().minus(lastOffsetPoint).dot(projection)); --- 227,234 ---- */ public void onVertex() { ! if (start != null && current != null && offsetCoord != null) { ! updateFeedback(); ! endOffset(); ! /* Vertex lengthVector = start.vertex().minus(current.vertex()); Vertex projection = outNormal.copy(); projection.scale(start.vertex().minus(lastOffsetPoint).dot(projection)); *************** *** 220,224 **** moveContour(length - projectionLength); } ! endOffset(); } } --- 240,244 ---- moveContour(length - projectionLength); } ! endOffset();*/ } } *************** *** 236,253 **** * {@inheritDoc} */ - public void prepare() { - super.prepare(); - cleanSelection(); - } - - /** - * {@inheritDoc} - */ @Override public void cleanUp() { directionMap = new HashMap(); contour.clear(); ! lastOffsetPoint = null; ! surfaceFound = false; outNormal = null; edgePoint = null; --- 256,266 ---- * {@inheritDoc} */ @Override public void cleanUp() { directionMap = new HashMap(); + guide.setFrom(new Vertex(0, 0, 0)); + guide.setTo(new Vertex(0, 0, 0)); contour.clear(); ! offsetSurface = null; outNormal = null; edgePoint = null; *************** *** 255,258 **** --- 268,272 ---- feedback(contour); super.cleanUp(); + prepare(); } *************** *** 280,296 **** /** - * Update the length field - */ - protected void updateLength() { - if (start != null && lastOffsetPoint != null && outNormal != null) { - Vertex projection = outNormal.copy(); - projection.scale((lastOffsetPoint.minus(start.vertex())).dot(projection)); - setLength(projection.length()); - } else { - super.updateLength(); - } - } - - /** * Tip on how to set the first click * @return short describtion of what to do --- 294,297 ---- *************** *** 310,312 **** --- 311,422 ---- " Press Escape to cancel offset"; } + + /** + * {@inheritDoc} + */ + @Override + public void prepare() { + super.prepare(); + finalEdgeList.clear(); + Selection selection = getSelection(); + if (!selection.isEmpty()) { + if (selection.size() == 1) { + selection.clear(); + return; + } + Collection<Edge> edges = new HashSet<Edge>(selection.size()); + Map<Vertex, Collection<Edge>> vertex2edges = new HashMap<Vertex, Collection<Edge>>(); + Edge first = null; + for (Geometric g : selection) { + if (g instanceof Edge) { + Edge e = (Edge)g; + edges.add(e); + Collection<Edge> fromlist = vertex2edges.get(e.getFrom()); + if (fromlist != null) { + fromlist.add(e); + } else { + fromlist = new ArrayList<Edge>(); + fromlist.add(e); + vertex2edges.put(e.getFrom(), fromlist); + } + Collection<Edge> tolist = vertex2edges.get(e.getTo()); + if (tolist != null) { + tolist.add(e); + } else { + tolist = new ArrayList<Edge>(); + tolist.add(e); + vertex2edges.put(e.getTo(), tolist); + } + } else { + edges.clear(); + selection.clear(); + } + } + //Sort the edges so that they are connected + Vertex firstVertex = null; + int firstCount = 0; + for (Vertex v : vertex2edges.keySet()) { + Collection<Edge> fromConnected = vertex2edges.get(v); + if (fromConnected.size() > 2) { + // The edges have to be in one connected not several + finalEdgeList.clear(); + selection.clear(); + break; + } + if (fromConnected.size() == 1) { + //if the vertex only have one connected edge add it is the first + if (firstVertex == null) { + first = fromConnected.iterator().next(); + finalEdgeList.add(first); + firstVertex = v; + } + firstCount++; + } + } + if (firstCount > 2) { + //Can only have two ends + finalEdgeList.clear(); + selection.clear(); + } + if (!finalEdgeList.isEmpty()) { + Edge workEdge = finalEdgeList.get(0); + Vertex workVertex = firstVertex; + while (true) { + workVertex = workEdge.otherVertex(workVertex); + Collection<Edge> connected = vertex2edges.get(workVertex); + Edge prevWorkEdge = workEdge; + for (Edge e : connected) { + if (e != workEdge) { + workEdge = e; + finalEdgeList.add(workEdge); + break; + } + } + if (prevWorkEdge == workEdge) { + break; + } + } + Vertex n = null; + if (finalEdgeList.size() == 2) { + Edge e1 = finalEdgeList.get(0); + Edge e2 = finalEdgeList.get(1); + double angle = e1.getDirection().angle(e2.getDirection()); + if (angle > 0 && angle < Math.PI) { + n = e1.getDirection().cross(e2.getDirection()); + } else { + finalEdgeList.clear(); + selection.clear(); + } + } else { + n = Surface.normal0(finalEdgeList); + } + if (n != null) { + Vertex i = first.getDirection(); + i.normalize(); + Vertex j = n.cross(i); + offsetCoord = new CoordinateSystem(i, j, n, first.getFrom()); + } + } + } + } } |
From: rimestad <rim...@us...> - 2007-09-27 10:50:11
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15081/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Log Message: Made som visual feedback and a changed structur for extrusion Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** Edge.java 13 Aug 2007 11:36:21 -0000 1.95 --- Edge.java 27 Sep 2007 10:50:13 -0000 1.96 *************** *** 706,710 **** * @return an offset-direction map for each vertex */ ! public static Map<Vertex, Vertex> offsetDirections(List<Edge> which, Surface inner, double offset) { Map<Edge, Double> offsets = new HashMap<Edge, Double>(); --- 706,710 ---- * @return an offset-direction map for each vertex */ ! public static Map<Vertex, Vertex> offsetDirections(List<Edge> which, CoordinateSystem inner, double offset) { Map<Edge, Double> offsets = new HashMap<Edge, Double>(); *************** *** 725,730 **** * @return an offset-direction map for each vertex */ ! public static Map<Vertex, Vertex> offsetDirections(List<Edge> which, Surface inner, ! Map<Edge, Double> offsetMap) { Map<Vertex, Vertex> v2Dir = new HashMap<Vertex, Vertex>(); Edge e1 = null; --- 725,730 ---- * @return an offset-direction map for each vertex */ ! public static Map<Vertex, Vertex> offsetDirections(List<Edge> which, ! CoordinateSystem inner, Map<Edge, Double> offsetMap) { Map<Vertex, Vertex> v2Dir = new HashMap<Vertex, Vertex>(); Edge e1 = null; *************** *** 733,737 **** Vertex work; boolean done = false; ! Iterator edges2 = inner.getEdges().iterator(); if (edges2.hasNext()) { first = (Edge)edges2.next(); --- 733,737 ---- Vertex work; boolean done = false; ! Iterator edges2 = which.iterator(); if (edges2.hasNext()) { first = (Edge)edges2.next(); *************** *** 743,747 **** done = true; } ! Vertex normal = inner.normal(); while (!done) { work = commonVertex(e1, e2); --- 743,747 ---- done = true; } ! Vertex normal = inner.getN(); while (!done) { work = commonVertex(e1, e2); *************** *** 823,827 **** e2e.put(e, new Edge((Vertex)v2v.get(from), (Vertex)v2v.get(to))); } ! Map directions = offsetDirections(which, inner, offsetMap); Edge e1 = null; Edge e2 = null; --- 823,827 ---- e2e.put(e, new Edge((Vertex)v2v.get(from), (Vertex)v2v.get(to))); } ! Map directions = offsetDirections(which, inner.coordinateSystem(), offsetMap); Edge e1 = null; Edge e2 = null; *************** *** 884,907 **** * @return The generated list of Edges */ ! public static List<Edge> offset(List<Edge> which, Surface inner, double offset) { ! return offset(which, inner, offset, null); } /** * Create a offset from a list of lines and a surface ! * PRECONDITION: all the edges have to be in the given surface. * @param which The list of edges in inner that are going to be offset * @param inner The surface ! * @param offset The offset: negative inside and positive outside ! * @param directions The movement directions send a empty list to retrieve direction map * @return The generated list of Edges */ ! public static List <Edge> offset(List<Edge> which, Surface inner, ! double offset, Map<Vertex, Direction> directions) { ! Map<Edge, Double> offsetMap = new HashMap<Edge, Double>(); ! for (Edge e : which) { ! offsetMap.put(e, Double.valueOf(offset)); ! } ! return offset(which, inner, offsetMap, directions); } --- 884,903 ---- * @return The generated list of Edges */ ! public static List<Edge> offset(Collection<Edge> which, Surface inner, double offset) { ! return offset(which, inner.coordinateSystem(), offset, null); } /** * Create a offset from a list of lines and a surface ! * PRECONDITION: all the edges have to be in the given surface and the edges ! * in the surface have to be counter clockwise drawn. If the edges are drawn clockwise ! * the offset will be negative outside and positive inside * @param which The list of edges in inner that are going to be offset * @param inner The surface ! * @param offset The offset negative inside and positive outside * @return The generated list of Edges */ ! public static List<Edge> offset(Collection<Edge> which, CoordinateSystem inner, double offset) { ! return offset(which, inner, offset, null); } *************** *** 911,920 **** * @param which The list of edges in inner that are going to be offset * @param inner The surface ! * @param offsetMap mapping each edge to the amount it should be offset * @param directions The movement directions send a empty list to retrieve direction map * @return The generated list of Edges */ ! public static List<Edge> offset(List<Edge> which, Surface inner, ! Map<Edge, Double> offsetMap, Map<Vertex, Direction> directions) { HashSet<Edge> edges = new HashSet<Edge>(which); ArrayList<Edge> res = new ArrayList<Edge>(); --- 907,916 ---- * @param which The list of edges in inner that are going to be offset * @param inner The surface ! * @param offset The offset size * @param directions The movement directions send a empty list to retrieve direction map * @return The generated list of Edges */ ! public static List<Edge> offset(Collection<Edge> which, CoordinateSystem inner, ! double offset, Map<Vertex, Direction> directions) { HashSet<Edge> edges = new HashSet<Edge>(which); ArrayList<Edge> res = new ArrayList<Edge>(); *************** *** 928,932 **** Edge firstEdge = null; // Find all the affected vertices and make the new edges ! Iterator iter = inner.getEdges().iterator(); while (iter.hasNext()) { Edge e = (Edge)iter.next(); --- 924,929 ---- Edge firstEdge = null; // Find all the affected vertices and make the new edges ! Vertex common = null; ! Iterator iter = which.iterator(); while (iter.hasNext()) { Edge e = (Edge)iter.next(); *************** *** 950,956 **** } if (prevEdge != null) { ! Vertex common = commonVertex(prevEdge, e); ! from2edge.put(common, prevEdge); ! to2edge.put(common, e); } else { firstEdge = e; --- 947,960 ---- } if (prevEdge != null) { ! common = commonVertex(prevEdge, e); ! if (common != null) { ! from2edge.put(common, e); ! to2edge.put(common, prevEdge); ! if (prevEdge == firstEdge) { ! from2edge.put(firstEdge.otherVertex(common), firstEdge); ! } ! } else { ! log.error("The collection of given edges have to be connected"); ! } } else { firstEdge = e; *************** *** 958,973 **** prevEdge = e; } ! Vertex common = commonVertex(firstEdge, prevEdge); ! from2edge.put(common, prevEdge); ! to2edge.put(common, firstEdge); // calculate the directions ! Vertex normal = inner.normal(); iter = directions.values().iterator(); while (iter.hasNext()) { Direction dir = (Direction)iter.next(); Vertex work = (Vertex)v2v.get(dir.getVertex()); ! Edge e1 = (Edge)to2edge.get(work); ! Edge e2 = (Edge)from2edge.get(work); if (edges.contains(e1)) { if (edges.contains(e2)) { --- 962,978 ---- prevEdge = e; } ! if (common != null) { ! to2edge.put(prevEdge.otherVertex(common), prevEdge); ! } // calculate the directions ! Vertex normal = inner.getN(); ! iter = directions.values().iterator(); while (iter.hasNext()) { Direction dir = (Direction)iter.next(); Vertex work = (Vertex)v2v.get(dir.getVertex()); ! Edge e1 = (Edge)from2edge.get(work); ! Edge e2 = (Edge)to2edge.get(work); if (edges.contains(e1)) { if (edges.contains(e2)) { *************** *** 987,995 **** dir1 = dir1.cross(normal); dir1.normalize(); ! Vertex other = e2.otherVertex(work); ! Vertex dir2 = other.minus(work); ! dir2.normalize(); ! dir2.scale(1 / dir2.dot(dir1)); ! dir.setDirection(dir2); } } else if (edges.contains(e2)) { --- 992,1012 ---- dir1 = dir1.cross(normal); dir1.normalize(); ! if (e2 == null) { ! for (Edge connected : work.getEdges()) { ! Vertex newdirection = dir1; ! if (connected != e1 && inner.isInXYPlane(connected)) { ! e2 = connected; ! } ! } ! } ! if (e2 != null) { ! Vertex other = e2.otherVertex(work); ! Vertex dir2 = other.minus(work); ! dir2.normalize(); ! dir2.scale(1 / dir2.dot(dir1)); ! dir.setDirection(dir2); ! } else { ! dir.setDirection(dir1); ! } } } else if (edges.contains(e2)) { *************** *** 998,1006 **** dir2 = dir2.cross(normal); dir2.normalize(); ! Vertex other = e1.otherVertex(work); ! Vertex dir1 = other.minus(work); ! dir1.normalize(); ! dir1.scale(1 / dir1.dot(dir2)); ! dir.setDirection(dir1); } } --- 1015,1037 ---- dir2 = dir2.cross(normal); dir2.normalize(); ! if (e1 == null) { ! for (Edge connected : work.getEdges()) { ! if (connected != e2 && inner.isInXYPlane(connected)) { ! e1 = connected; ! } ! } ! } ! if (e1 != null) { ! Vertex other = e1.otherVertex(work); ! Vertex dir1 = other.minus(work); ! dir1.normalize(); ! dir1.scale(1 / dir1.dot(dir2)); ! dir.setDirection(dir1); ! } else { ! dir.setDirection(dir2); ! } ! } else { ! dir.setDirection(new Vertex(0, 0, 0)); ! log.error("The consistence for " + work + " weird got no conected edges"); } } *************** *** 1012,1016 **** dir.scale(-1); dir = dir.copy(); ! dir.scale(((Double)offsetMap.values().iterator().next()).doubleValue()); cur.getVertex().move(dir.getX(), dir.getY(), dir.getZ()); } --- 1043,1047 ---- dir.scale(-1); dir = dir.copy(); ! dir.scale(offset); cur.getVertex().move(dir.getX(), dir.getY(), dir.getZ()); } |
From: rimestad <rim...@us...> - 2007-09-27 10:49:15
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14698/src/net/sourceforge/bprocessor/gl/tool Modified Files: ControlledExtrudeTool.java Log Message: Improvements on ControlledExtrude Index: ControlledExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/ControlledExtrudeTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ControlledExtrudeTool.java 22 Sep 2007 13:55:25 -0000 1.2 --- ControlledExtrudeTool.java 27 Sep 2007 10:49:17 -0000 1.3 *************** *** 9,12 **** --- 9,14 ---- import java.awt.Cursor; import java.awt.event.MouseEvent; + import java.util.ArrayList; + import java.util.Collection; import java.util.HashMap; import java.util.HashSet; *************** *** 21,24 **** --- 23,27 ---- import net.sourceforge.bprocessor.model.Direction; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Mesh; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; *************** *** 43,46 **** --- 46,54 ---- private Map<Vertex, Direction> v2dir; private Surface pressedSurface; + private Plane dragPlane; + private Collection<Surface> affected; + private Vertex normal; + private double maxExtrude; + private double minExtrude; /** *************** *** 52,55 **** --- 60,64 ---- super(glv, cursor); extrusion = new HashSet<Surface>(); + affected = new HashSet<Surface>(); v2dir = new HashMap<Vertex, Direction>(); } *************** *** 59,63 **** public void onVertex() { if (pressedSurface != null) { - Vertex normal = pressedSurface.normal(); Plane p = new Plane(normal.getX(), normal.getY(), normal.getZ(), current.vertex()); extrudeTo(p); --- 68,71 ---- *************** *** 71,75 **** findTarget(e, View.HANDLES); if (pressedSurface == null) { ! glv.getView().makeTarget(target); } else { double x = e.getX(); --- 79,85 ---- findTarget(e, View.HANDLES); if (pressedSurface == null) { ! if (target instanceof Surface) { ! glv.getView().makeTarget(target); ! } } else { double x = e.getX(); *************** *** 81,90 **** Transformation transformation = glv.getView().transformation(); ray = transformation.unProject(ray); ! Vertex hit = lockingPlane.intersection(ray); ! Vertex normal = pressedSurface.normal(); current = new Intersection(hit.minus(start.vertex()).projectOnto(normal).add(start.vertex()), ! Intersection.PLANE_INTERSECTION, lockingPlane); ! Plane p = new Plane(normal.getX(), normal.getY(), normal.getZ(), current.vertex()); if (v2dir.isEmpty()) { Vertex delta = current.vertex().minus(start.vertex()); double length = delta.length(); --- 91,111 ---- Transformation transformation = glv.getView().transformation(); ray = transformation.unProject(ray); ! Vertex hit = dragPlane.intersection(ray); current = new Intersection(hit.minus(start.vertex()).projectOnto(normal).add(start.vertex()), ! Intersection.PLANE_INTERSECTION, dragPlane); ! //Find the plane to extrude to ! Plane p = null; ! if (target instanceof Surface && !affected.contains(target)) { ! p = ((Surface)target).plane(); ! if (Math.abs((Math.abs(p.normal().angle(normal)) - Math.PI / 2)) < 0.01) { ! p = null; ! } ! } ! if (p == null) { ! p = new Plane(normal.getX(), normal.getY(), normal.getZ(), current.vertex()); ! } ! if (v2dir.isEmpty()) { + // If the extrusion isn't started start it Vertex delta = current.vertex().minus(start.vertex()); double length = delta.length(); *************** *** 92,111 **** length *= -1; } Surface topSurface = pressedSurface.extrusionControlled(length, extrusion, v2dir); - log.info("Elements in extrusion " + extrusion.size()); if (topSurface != pressedSurface) { extrusion.add(topSurface); } ! excluded(extrusion); ! excluded.add(pressedSurface); ! pressedSurface.getOwner().addProtected(extrusion); ! feedback(extrusion); ! } - extrudeTo(p); } } private void extrudeTo(Plane p) { for (Vertex v : v2dir.keySet()) { Direction d = v2dir.get(v); --- 113,158 ---- length *= -1; } + + Collection feed = new ArrayList(); + feed.add(new Edge(start.vertex(), start.vertex().add(normal))); + feedback(feed); + Surface topSurface = pressedSurface.extrusionControlled(length, extrusion, v2dir); if (topSurface != pressedSurface) { extrusion.add(topSurface); } ! affected.add(pressedSurface); ! affected.addAll(extrusion); ! affected.addAll(Edge.surfaces(topSurface.getEdges())); ! excluded(affected); ! Project.getInstance().getActiveSpace().addProtected(extrusion); ! maxExtrude = Double.POSITIVE_INFINITY; ! minExtrude = Double.NEGATIVE_INFINITY; ! for (Vertex v : v2dir.keySet()) { ! Direction d = v2dir.get(v); ! if (d.upper() < maxExtrude) { ! maxExtrude = d.upper(); ! } ! if (d.lower() > minExtrude) { ! minExtrude = d.lower(); ! } ! } ! } else { ! //there is a extrusion move it to the apropiate location ! extrudeTo(p); } } } private void extrudeTo(Plane p) { + double dist = p.distance(start.vertex()) * -1; + if (dist < minExtrude) { + p.moveDelta(dist - minExtrude); + } + if (dist > maxExtrude) { + p.moveDelta(dist - maxExtrude); + } + current.vertex().set(p.intersection(start.vertex(), normal, true)); + for (Vertex v : v2dir.keySet()) { Direction d = v2dir.get(v); *************** *** 121,127 **** current = findIntersection(e); if (v2dir.isEmpty() && target != null && target instanceof Surface) { start = current; pressedSurface = (Surface)target; - lock = true; Transformation transformation = glv.getView().transformation(); double x = e.getX(); --- 168,174 ---- current = findIntersection(e); if (v2dir.isEmpty() && target != null && target instanceof Surface) { + active = true; start = current; pressedSurface = (Surface)target; Transformation transformation = glv.getView().transformation(); double x = e.getX(); *************** *** 134,141 **** Vertex dir = ray.getDirection(); dir.normalize(); ! Vertex normal = pressedSurface.normal(); Vertex tmp = dir.cross(normal); dir = tmp.cross(normal); ! lockingPlane = new Plane(dir.getX(), dir.getY(), dir.getZ(), pressedSurface.intersection(ray)); } else { --- 181,188 ---- Vertex dir = ray.getDirection(); dir.normalize(); ! normal = pressedSurface.normal(); Vertex tmp = dir.cross(normal); dir = tmp.cross(normal); ! dragPlane = new Plane(dir.getX(), dir.getY(), dir.getZ(), pressedSurface.intersection(ray)); } else { *************** *** 145,152 **** private void finishTool() { ! Space owner = pressedSurface.getOwner(); owner.removeProtected(extrusion); ! ExtrusionTool.insert(owner, extrusion); ! Project.getInstance().checkpoint(); cleanUp(); } --- 192,204 ---- private void finishTool() { ! Space owner = Project.getInstance().getActiveSpace(); owner.removeProtected(extrusion); ! if (pressedSurface != null && !start.vertex().minus(current.vertex()).isZero()) { ! excluded(new ArrayList()); ! Mesh m = new Mesh(extrusion); ! owner.insert(m); ! owner.changed(); ! Project.getInstance().checkpoint(); ! } cleanUp(); } *************** *** 164,170 **** @Override public void escape() { ! Vertex n = pressedSurface.normal(); ! extrudeTo(new Plane(n.getX(), n.getY(), n.getZ(), start.vertex())); ! pressedSurface.getOwner().removeProtected(extrusion); cleanUp(); } --- 216,223 ---- @Override public void escape() { ! if (pressedSurface != null) { ! extrudeTo(new Plane(normal.getX(), normal.getY(), normal.getZ(), start.vertex())); ! Project.getInstance().getActiveSpace().removeProtected(extrusion); ! } cleanUp(); } *************** *** 175,180 **** --- 228,238 ---- super.cleanUp(); extrusion.clear(); + affected.clear(); v2dir.clear(); pressedSurface = null; + normal = null; + active = false; + maxExtrude = Double.POSITIVE_INFINITY; + minExtrude = Double.NEGATIVE_INFINITY; } |
From: rimestad <rim...@us...> - 2007-09-27 10:48:54
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14315/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java ToolFactory.java Log Message: Made getPrevious tool private in ToolFactory and changed the callers to use getTool(Tool.PREVIOUS_TOOL) instead Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** ToolFactory.java 19 Sep 2007 20:57:47 -0000 1.85 --- ToolFactory.java 27 Sep 2007 10:48:53 -0000 1.86 *************** *** 343,347 **** * @return The tool */ ! public Tool getPrevious() { Tool temp = previousTool; previousTool = currentTool; --- 343,347 ---- * @return The tool */ ! private Tool getPrevious() { Tool temp = previousTool; previousTool = currentTool; Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** AbstractTool.java 24 Sep 2007 13:02:17 -0000 1.131 --- AbstractTool.java 27 Sep 2007 10:48:53 -0000 1.132 *************** *** 191,197 **** tool = factory.get(Tool.SELECT_TOOL); } else { ! Tool prev = factory.getPrevious(); if (prev != this) { ! factory.getPrevious(); } tool = this; --- 191,200 ---- tool = factory.get(Tool.SELECT_TOOL); } else { ! if (activeStrategy == AbstractTool.select) { ! this.prepare(); ! } ! Tool prev = factory.get(Tool.PREVIOUS_TOOL); if (prev != this) { ! factory.get(Tool.PREVIOUS_TOOL); } tool = this; *************** *** 526,530 **** * @return The collection of selected objects */ ! public Collection getSelection() { return Selection.primary(); } --- 529,533 ---- * @return The collection of selected objects */ ! public Selection getSelection() { return Selection.primary(); } |
From: rimestad <rim...@us...> - 2007-09-27 10:48:54
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14315/src/net/sourceforge/bprocessor/gl Modified Files: GLView.java Log Message: Made getPrevious tool private in ToolFactory and changed the callers to use getTool(Tool.PREVIOUS_TOOL) instead Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** GLView.java 22 Sep 2007 13:54:50 -0000 1.64 --- GLView.java 27 Sep 2007 10:48:53 -0000 1.65 *************** *** 195,199 **** glc.removeKeyListener(tool); if (mode == Tool.PREVIOUS_TOOL) { ! tool = ToolFactory.getFactory(this).getPrevious(); } else { tool = ToolFactory.getFactory(this).get(mode); --- 195,199 ---- glc.removeKeyListener(tool); if (mode == Tool.PREVIOUS_TOOL) { ! tool = ToolFactory.getFactory(this).get(Tool.PREVIOUS_TOOL); } else { tool = ToolFactory.getFactory(this).get(mode); |
From: rimestad <rim...@us...> - 2007-09-27 10:47:46
|
Update of /cvsroot/bprocessor//test/src/net/sourceforge/bprocessor/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13898/src/net/sourceforge/bprocessor/test Modified Files: NormalsBenchmark.java SurfaceNormal.java Log Message: Changed to reflect the changed input on normal0 Index: SurfaceNormal.java =================================================================== RCS file: /cvsroot/bprocessor//test/src/net/sourceforge/bprocessor/test/SurfaceNormal.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SurfaceNormal.java 6 Jul 2007 09:50:39 -0000 1.3 --- SurfaceNormal.java 27 Sep 2007 10:47:47 -0000 1.4 *************** *** 50,54 **** while (iter.hasNext()) { Surface current = (Surface) iter.next(); ! Vertex normal = current.normal0(); System.out.println(current.getName() + " normal: " + normal); } --- 50,54 ---- while (iter.hasNext()) { Surface current = (Surface) iter.next(); ! Vertex normal = current.normal(); System.out.println(current.getName() + " normal: " + normal); } Index: NormalsBenchmark.java =================================================================== RCS file: /cvsroot/bprocessor//test/src/net/sourceforge/bprocessor/test/NormalsBenchmark.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NormalsBenchmark.java 25 Jan 2007 10:21:04 -0000 1.1 --- NormalsBenchmark.java 27 Sep 2007 10:47:47 -0000 1.2 *************** *** 98,102 **** while (count < array.length) { Surface current = array[count]; ! Vertex normal = current.normal0(); count++; } --- 98,102 ---- while (count < array.length) { Surface current = array[count]; ! Vertex normal = current.normal(); count++; } |
From: rimestad <rim...@us...> - 2007-09-27 10:47:18
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13767/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: made normal0 more general by taking a list of edges to make a normal according to. Moved alle extrude methods to be the same place in the surface class. Made some major changes to controlledExtrusion Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.181 retrieving revision 1.182 diff -C2 -d -r1.181 -r1.182 *** Surface.java 27 Sep 2007 08:33:13 -0000 1.181 --- Surface.java 27 Sep 2007 10:47:09 -0000 1.182 *************** *** 777,783 **** Vertex normal = normal(); ! List vertices = getVertices(); ! List edges = getEdges(); int n = vertices.size(); --- 777,783 ---- Vertex normal = normal(); ! List<Vertex> vertices = getVertices(); ! List<Edge> edges = getEdges(); int n = vertices.size(); *************** *** 870,878 **** * @return The resulting top surface */ ! public Surface extrusionControlled(double delta, Set sides, Map v2dir) { ! return extrudeControlled(delta, sides, new HashMap(), new HashMap(), new HashMap(), v2dir); } /** * Make the new vertices, edges and surfaces for extrusion * @param delta the length of extrusion in meters --- 870,1012 ---- * @return The resulting top surface */ ! public Surface extrusionControlled(double delta, Set<Surface> sides, ! Map<Vertex, Direction> v2dir) { ! return extrudeControlled(delta, sides, new HashMap<Edge, Edge>(), ! new HashMap<Vertex, Edge>(), new HashMap<Edge, Surface>(), v2dir); } /** + * @param p the plane to extrude onto + * @param sides the collection of all resulting side surfaces + * @param distance The distance of the extrusion as a backup when plane is orthogonal + * @return the new extrusion top surface + */ + public Surface extrusionOnto(Plane p, double distance, Collection<Surface> sides) { + if (p == null) { + log.info("p were null for " + this); + return null; + } + Vertex normal = normal(); + List vertices = getVertices(); + List edges = getEdges(); + int n = vertices.size(); + Vertex[] v = new Vertex[n]; + Edge[] e = new Edge[n]; + Vertex[] vmap = new Vertex[n]; + Edge[] topmap = new Edge[n]; + Edge[] sidemap = new Edge[n]; + Surface[] facemap = new Surface[n]; + Surface top = null; + vertices.toArray(v); + edges.toArray(e); + + for (int i = 0; i < n; i++) { + Vertex inter = p.intersection(v[i], normal, true); + if (inter != null) { + vmap[i] = inter; + } else { + Vertex ncopy = normal.copy(); + ncopy.scale(distance); + vmap[i] = v[i].copy().add(ncopy); + } + } + + for (int i = 0; i < n; i++) { + topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); + } + + for (int i = 0; i < n; i++) { + sidemap[i] = new Edge(v[i], vmap[i]); + } + + for (int i = 0; i < n; i++) { + Edge b = e[i]; + Edge r = sidemap[i]; + Edge l = sidemap[(i + 1) % n]; + Edge t = topmap[i]; + List newEdges = new LinkedList(); + newEdges.add(r); + newEdges.add(t); + newEdges.add(l); + newEdges.add(b); + facemap[i] = new Surface(newEdges); + sides.add(facemap[i]); + } + + { + List newEdges = new LinkedList(); + for (int i = 0; i < n; i++) { + newEdges.add(topmap[n - i - 1]); + } + top = new Surface(newEdges); + } + + // FIXME should return the sides instead of assigning + // spaces here. + boolean flip = false; + boolean inside = false; + + + if (exterior != null) { + Vertex n0 = normal(); + Vertex n1 = exterior.normal(); + Vertex o = n0.add(n1); + if (o.isZero()) { + flip = true; + } + inside = exterior.getOwner() == getOwner(); + } + // positive for angles less then 90 degrees and negative otherwise + double delta = normal.dot(sidemap[0].getDirection()); + for (int i = 0; i < n; i++) { + if (delta < 0) { + facemap[i].setBackDomain(getBackDomain()); + if (exterior != null && inside) { + if (flip) { + facemap[i].setFrontDomain(exterior.getFrontDomain()); + } else { + facemap[i].setFrontDomain(exterior.getBackDomain()); + } + } + } else { + facemap[i].setFrontDomain(getFrontDomain()); + if (exterior != null && inside) { + if (flip) { + facemap[i].setBackDomain(exterior.getBackDomain()); + } else { + facemap[i].setBackDomain(exterior.getFrontDomain()); + } + } + } + } + if (delta < 0) { + top.setBackDomain(getBackDomain()); + } else { + top.setFrontDomain(getFrontDomain()); + } + return top; + } + + /** + * @param p The plane to extrude onto + * @param sides The the collection of already extruded sides (if none the resulting is added) + * @param distance the distance of the extrusion as a backup if the plane is orthogonal + * @param tops The top surfaces + * @return the new created extrusion top surface + */ + public Surface extrusionAllOnto(Plane p, double distance, + Collection<Surface> sides, Set<Surface> tops) { + Surface top = extrusionOnto(p, distance, sides); + tops.add(top); + Iterator iter = getHoles().iterator(); + while (iter.hasNext()) { + Surface hole = (Surface) iter.next(); + Surface holetop = hole.extrusionAllOnto(p, distance, sides, tops); + top.addHole(holetop); + } + return top; + } + + /** * Make the new vertices, edges and surfaces for extrusion * @param delta the length of extrusion in meters *************** *** 884,894 **** * @return The top in the extruded surface */ ! public Surface extrudeControlled(double delta, Set sides, Map e2e, Map v2e, Map e2s, Map v2dir) { Vertex normal = normal(); ! normal.scale(delta); boolean makeNewTop = true; ! List vertices = getVertices(); ! List edges = getEdges(); int n = vertices.size(); --- 1018,1029 ---- * @return The top in the extruded surface */ ! public Surface extrudeControlled(double delta, Set<Surface> sides, Map<Edge, Edge> e2e, ! Map<Vertex, Edge> v2e, Map<Edge, Surface> e2s, Map<Vertex, Direction> v2dir) { Vertex normal = normal(); ! Plane p = new Plane(normal.getX(), normal.getY(), normal.getZ(), this.getFirstVertex()); boolean makeNewTop = true; ! List<Vertex> vertices = getVertices(); ! List<Edge> edges = getEdges(); int n = vertices.size(); *************** *** 908,912 **** --- 1043,1056 ---- edges.toArray(e); + for (Surface hole : getHoles()) { + sides.add(hole.extrudeControlled(delta, sides, e2e, v2e, e2s, v2dir)); + } + for (int i = 0; i < n; i++) { + double min = 0, max = Double.POSITIVE_INFINITY; + if (delta < 0) { + min = Double.NEGATIVE_INFINITY; + max = 0; + } if (isVertexBounded(v[i])) { if (v2dir.containsKey(v[i])) { *************** *** 916,931 **** } else { vmap[i] = v[i].copy(); ! v2dir.put(v[i], new Direction(vmap[i], normal)); } } else { // We just have to move the existing surface makeNewTop = false; if (v2dir.containsKey(v[i])) { Direction d = (Direction)v2dir.get(v[i]); vmap[i] = d.getVertex(); ! d.alterDirection(normal); } else { vmap[i] = v[i]; ! v2dir.put(v[i], new Direction(v[i], normal)); } } --- 1060,1102 ---- } else { vmap[i] = v[i].copy(); ! v2dir.put(v[i], new Direction(vmap[i], normal, min, max)); } } else { // We just have to move the existing surface makeNewTop = false; + Collection<Edge> connected = v[i].getEdges(); + connected.removeAll(this.getEdges()); + Edge connectedEdge = null; + if (connected.size() == 1) { + connectedEdge = connected.iterator().next(); + } + Vertex dir; + Direction direction; + if (connectedEdge != null) { + Vertex edgeVertex = connectedEdge.otherVertex(v[i]).minus(v[i]); + dir = normal.projectOnto(edgeVertex); + dir.normalize(); + double angle = normal.angle(edgeVertex); + if (angle > Math.PI / 2) { + //connected Edge points backwards + min = -connectedEdge.getLength(); + max = Double.POSITIVE_INFINITY; + } else { + //connected Edge points along normal + max = connectedEdge.getLength(); + min = Double.NEGATIVE_INFINITY; + } + direction = new Direction(v[i], dir, min, max); + } else { + dir = normal; + direction = new Direction(v[i], dir, min, max); + } if (v2dir.containsKey(v[i])) { Direction d = (Direction)v2dir.get(v[i]); vmap[i] = d.getVertex(); ! d.alterDirection(dir); } else { vmap[i] = v[i]; ! v2dir.put(v[i], direction); } } *************** *** 934,940 **** for (int i = 0; i < n; i++) { //move points delta ! vmap[i].setX(vmap[i].getX() + normal.getX()); ! vmap[i].setY(vmap[i].getY() + normal.getY()); ! vmap[i].setZ(vmap[i].getZ() + normal.getZ()); //make edges if (e2e.containsKey(e[i])) { --- 1105,1110 ---- for (int i = 0; i < n; i++) { //move points delta ! Direction dir = v2dir.get(v[i]); ! vmap[i].set(p.intersection(vmap[i], dir.getDirection(), true)); //make edges if (e2e.containsKey(e[i])) { *************** *** 950,954 **** } ! List lst = new LinkedList(); for (int i = 0; i < n; i++) { if (v2e.containsKey(v[i])) { --- 1120,1124 ---- } ! List<Edge> lst = new LinkedList<Edge>(); for (int i = 0; i < n; i++) { if (v2e.containsKey(v[i])) { *************** *** 965,969 **** } else { if (!makeNewTop) { ! Collection newE = new LinkedList(); if (vmap[(i + 1) % n] == v[(i + 1) % n] && vmap[(i + n - 1) % n] == v[(i + n - 1) % n]) { --- 1135,1139 ---- } else { if (!makeNewTop) { ! Collection<Edge> newE = new LinkedList<Edge>(); if (vmap[(i + 1) % n] == v[(i + 1) % n] && vmap[(i + n - 1) % n] == v[(i + n - 1) % n]) { *************** *** 1016,1020 **** Edge l = sidemap[(i + 1) % n]; Edge t = topmap[i]; ! List newEdges = new LinkedList(); newEdges.add(r); newEdges.add(t); --- 1186,1190 ---- Edge l = sidemap[(i + 1) % n]; Edge t = topmap[i]; ! List<Edge> newEdges = new LinkedList<Edge>(); newEdges.add(r); newEdges.add(t); *************** *** 1029,1037 **** if (makeNewTop) { ! List newEdges = new LinkedList(); for (int i = 0; i < n; i++) { newEdges.add(topmap[n - i - 1]); } top = new Surface(newEdges); } else { top = this; --- 1199,1208 ---- if (makeNewTop) { ! List<Edge> newEdges = new LinkedList<Edge>(); for (int i = 0; i < n; i++) { newEdges.add(topmap[n - i - 1]); } top = new Surface(newEdges); + sides.add(top); } else { top = this; *************** *** 1090,1094 **** /** ! * Check if the given vertex is free (do not have a edge to follow in move og pull), that is * 1) it is only part of the parent surface (this) or * 2) it is only connected to one edge not in this surface, which is not in --- 1261,1265 ---- /** ! * Check if the given vertex is bounded, that is * 1) it is only part of the parent surface (this) or * 2) it is only connected to one edge not in this surface, which is not in *************** *** 1102,1106 **** case 3: //If the third connected edge is not in the plane of the surface ! //it is not free otherwise it is Plane plane = this.plane(); for (Edge e : connected) { --- 1273,1277 ---- case 3: //If the third connected edge is not in the plane of the surface ! //it is not bounded otherwise it is Plane plane = this.plane(); for (Edge e : connected) { *************** *** 1118,1121 **** --- 1289,1295 ---- } break; + default: + + break; } return true; *************** *** 1424,1435 **** public Vertex normal() { ! return normal0(); } /** * USE normal for the normal * @return value */ ! public Vertex normal0() { int size = edges.size(); Edge[] e = new Edge[size]; --- 1598,1610 ---- public Vertex normal() { ! return normal0(edges); } /** * USE normal for the normal + * @param edges The collection of edges to calculate the normal from * @return value */ ! public static Vertex normal0(Collection<Edge> edges) { int size = edges.size(); Edge[] e = new Edge[size]; *************** *** 1885,2020 **** /** - * @param p The plane to extrude onto - * @param sides The the collection of already extruded sides (if none the resulting is added) - * @param distance the distance of the extrusion as a backup if the plane is orthogonal - * @param tops The top surfaces - * @return the new created extrusion top surface - */ - public Surface extrusionAllOnto(Plane p, double distance, - Collection<Surface> sides, Set<Surface> tops) { - Surface top = extrusionOnto(p, distance, sides); - tops.add(top); - Iterator iter = getHoles().iterator(); - while (iter.hasNext()) { - Surface hole = (Surface) iter.next(); - Surface holetop = hole.extrusionAllOnto(p, distance, sides, tops); - top.addHole(holetop); - } - return top; - } - - /** - * @param p the plane to extrude onto - * @param sides the collection of all resulting side surfaces - * @param distance The distance of the extrusion as a backup when plane is orthogonal - * @return the new extrusion top surface - */ - public Surface extrusionOnto(Plane p, double distance, Collection<Surface> sides) { - if (p == null) { - log.info("p were null for " + this); - return null; - } - Vertex normal = normal(); - List vertices = getVertices(); - List edges = getEdges(); - int n = vertices.size(); - Vertex[] v = new Vertex[n]; - Edge[] e = new Edge[n]; - Vertex[] vmap = new Vertex[n]; - Edge[] topmap = new Edge[n]; - Edge[] sidemap = new Edge[n]; - Surface[] facemap = new Surface[n]; - Surface top = null; - vertices.toArray(v); - edges.toArray(e); - - for (int i = 0; i < n; i++) { - Vertex inter = p.intersection(v[i], normal, true); - if (inter != null) { - vmap[i] = inter; - } else { - Vertex ncopy = normal.copy(); - ncopy.scale(distance); - vmap[i] = v[i].copy().add(ncopy); - } - } - - for (int i = 0; i < n; i++) { - topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); - } - - for (int i = 0; i < n; i++) { - sidemap[i] = new Edge(v[i], vmap[i]); - } - - for (int i = 0; i < n; i++) { - Edge b = e[i]; - Edge r = sidemap[i]; - Edge l = sidemap[(i + 1) % n]; - Edge t = topmap[i]; - List newEdges = new LinkedList(); - newEdges.add(r); - newEdges.add(t); - newEdges.add(l); - newEdges.add(b); - facemap[i] = new Surface(newEdges); - sides.add(facemap[i]); - } - - { - List newEdges = new LinkedList(); - for (int i = 0; i < n; i++) { - newEdges.add(topmap[n - i - 1]); - } - top = new Surface(newEdges); - } - - // FIXME should return the sides instead of assigning - // spaces here. - boolean flip = false; - boolean inside = false; - - - if (exterior != null) { - Vertex n0 = normal(); - Vertex n1 = exterior.normal(); - Vertex o = n0.add(n1); - if (o.isZero()) { - flip = true; - } - inside = exterior.getOwner() == getOwner(); - } - // positive for angles less then 90 degrees and negative otherwise - double delta = normal.dot(sidemap[0].getDirection()); - for (int i = 0; i < n; i++) { - if (delta < 0) { - facemap[i].setBackDomain(getBackDomain()); - if (exterior != null && inside) { - if (flip) { - facemap[i].setFrontDomain(exterior.getFrontDomain()); - } else { - facemap[i].setFrontDomain(exterior.getBackDomain()); - } - } - } else { - facemap[i].setFrontDomain(getFrontDomain()); - if (exterior != null && inside) { - if (flip) { - facemap[i].setBackDomain(exterior.getBackDomain()); - } else { - facemap[i].setBackDomain(exterior.getFrontDomain()); - } - } - } - } - if (delta < 0) { - top.setBackDomain(getBackDomain()); - } else { - top.setFrontDomain(getFrontDomain()); - } - return top; - } - - /** * Find the last hit vertex, when the given edge is used as sweepline across the surface * @precondtion The given edge is in the surface --- 2060,2063 ---- |
From: rimestad <rim...@us...> - 2007-09-27 10:44:49
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12693/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: When protected geom are removed from a space the geometrics are set back not to be protected anymore Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.175 retrieving revision 1.176 diff -C2 -d -r1.175 -r1.176 *** Space.java 25 Sep 2007 13:44:58 -0000 1.175 --- Space.java 27 Sep 2007 10:44:51 -0000 1.176 *************** *** 2323,2326 **** --- 2323,2327 ---- } remove(surface); + surface.protect(false); } for (Edge edge : surface.getEdges()) { *************** *** 2338,2341 **** --- 2339,2343 ---- if (edge.protect()) { remove(edge); + edge.protect(false); } removeProtected(edge.from); *************** *** 2352,2355 **** --- 2354,2358 ---- if (vertex.protect()) { remove(vertex); + vertex.protect(false); } } |
From: Michael L. <he...@us...> - 2007-09-27 10:44:19
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12658/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: Improved space propagation Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** GenericTreeView.java 27 Sep 2007 08:33:17 -0000 1.113 --- GenericTreeView.java 27 Sep 2007 10:44:17 -0000 1.114 *************** *** 784,788 **** public SurfaceNode(Surface surface) { super(surface); ! add(new EdgeContainer("Contour", surface.getEdges())); } --- 784,788 ---- public SurfaceNode(Surface surface) { super(surface); ! add(new EdgeContainer("Contour", surface.getEdges(), false)); } *************** *** 990,995 **** super(name, null, false); add(new SurfaceContainer("Surfaces", space.getSurfaces())); ! add(new EdgeContainer("Edges", space.getEdges())); ! add(new VertexContainer("Vertices", space.getVertices())); } --- 990,995 ---- super(name, null, false); add(new SurfaceContainer("Surfaces", space.getSurfaces())); ! add(new EdgeContainer("Edges", space.getEdges(), true)); ! add(new VertexContainer("Vertices", space.getVertices(), true)); } *************** *** 1046,1052 **** * @param name The name * @param edges The edges */ ! public EdgeContainer(String name, Collection edges) { ! super(name, edges, true); insertChildren(edges); } --- 1046,1053 ---- * @param name The name * @param edges The edges + * @param sort Sort the edges */ ! public EdgeContainer(String name, Collection edges, boolean sort) { ! super(name, edges, sort); insertChildren(edges); } *************** *** 1140,1146 **** * @param name The name * @param vertices The edges */ ! public VertexContainer(String name, Collection vertices) { ! super(name, vertices, true); insertChildren(vertices); } --- 1141,1148 ---- * @param name The name * @param vertices The edges + * @param sort sort the vertices */ ! public VertexContainer(String name, Collection vertices, boolean sort) { ! super(name, vertices, sort); insertChildren(vertices); } |
From: Michael L. <he...@us...> - 2007-09-27 10:44:12
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12633/src/net/sourceforge/bprocessor/model Modified Files: SpaceAnalysis.java Log Message: Improved space propagation Index: SpaceAnalysis.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SpaceAnalysis.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SpaceAnalysis.java 27 Sep 2007 08:33:13 -0000 1.4 --- SpaceAnalysis.java 27 Sep 2007 10:44:14 -0000 1.5 *************** *** 9,15 **** --- 9,18 ---- import java.util.HashMap; + import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; + import java.util.Queue; + import java.util.Set; /** *************** *** 22,25 **** --- 25,32 ---- private static final int BACKWARD = -1; + private Map<Edge, List<Surface>> edgemap; + private Queue<Element> queue; + private Set<Surface> mark; + private static int travel(Surface surface, Edge edge) { Vertex vertex = surface.getFirstVertex(); *************** *** 37,40 **** --- 44,66 ---- } + + private class Element { + private Surface surface; + private int side; + + public Element(Surface surface, int side) { + this.surface = surface; + this.side = side; + } + + public Surface surface() { + return surface; + } + + public int side() { + return side; + } + } + /** * Progates space assignment in specified direction *************** *** 45,49 **** public void propagate(Surface surface, int side) { Space space = surface.getOwner(); ! Map<Edge, List<Surface>> edgemap = new HashMap(); for (Edge current : space.getEdges()) { edgemap.put(current, new LinkedList()); --- 71,75 ---- public void propagate(Surface surface, int side) { Space space = surface.getOwner(); ! edgemap = new HashMap(); for (Edge current : space.getEdges()) { edgemap.put(current, new LinkedList()); *************** *** 55,73 **** } for (Edge current : surface.getEdges()) { List<Surface> surfaces = edgemap.get(current); if (surfaces.size() > 1) { Surface selected = select(current, surfaces, surface, side); ! if (travel(surface, current) == travel(selected, current)) { ! if (side == 1) { ! selected.setBackDomain(surface.getFrontDomain()); ! } else { ! selected.setFrontDomain(surface.getBackDomain()); ! } ! } else { ! if (side == 1) { ! selected.setFrontDomain(surface.getFrontDomain()); } else { ! selected.setBackDomain(surface.getBackDomain()); } } --- 81,116 ---- } + mark = new HashSet(); + queue = new LinkedList(); + queue.offer(new Element(surface, side)); + while (!queue.isEmpty()) { + Element element = queue.remove(); + process(element); + } + } + + private void process(Element element) { + Surface surface = element.surface(); + int side = element.side; + mark.add(surface); for (Edge current : surface.getEdges()) { List<Surface> surfaces = edgemap.get(current); if (surfaces.size() > 1) { Surface selected = select(current, surfaces, surface, side); ! if (!mark.contains(selected)) { ! if (travel(surface, current) == travel(selected, current)) { ! if (side == 1) { ! selected.setBackDomain(surface.getFrontDomain()); ! } else { ! selected.setFrontDomain(surface.getBackDomain()); ! } ! queue.offer(new Element(selected, -side)); } else { ! if (side == 1) { ! selected.setFrontDomain(surface.getFrontDomain()); ! } else { ! selected.setBackDomain(surface.getBackDomain()); ! } ! queue.offer(new Element(selected, side)); } } |
From: rimestad <rim...@us...> - 2007-09-27 10:43:36
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12255/src/net/sourceforge/bprocessor/model Modified Files: Plane.java Log Message: Added a method to move a delta plane along its normal Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Plane.java 11 Apr 2007 12:15:15 -0000 1.29 --- Plane.java 27 Sep 2007 10:43:38 -0000 1.30 *************** *** 351,353 **** --- 351,361 ---- log.info(info); } + + /** + * Move the plane along the normal the delta distance + * @param e The distance to move the plane + */ + public void moveDelta(double e) { + d += e; + } } |
From: rimestad <rim...@us...> - 2007-09-27 10:43:00
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11867/src/net/sourceforge/bprocessor/model Modified Files: Mesh.java Log Message: Gave the constructor a less conservative generic type constraint on the input list Index: Mesh.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Mesh.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Mesh.java 8 Jun 2007 10:51:34 -0000 1.20 --- Mesh.java 27 Sep 2007 10:43:02 -0000 1.21 *************** *** 47,54 **** * @param geometrics Collection of Geometric objects */ ! public Mesh(Collection<Geometric> geometrics) { ! Collection<Vertex> vertices = new HashSet(); ! Collection<Edge> edges = new HashSet(); ! Collection<Surface> surfaces = new HashSet(); for (Geometric current : geometrics) { if (current instanceof Surface) { --- 47,54 ---- * @param geometrics Collection of Geometric objects */ ! public Mesh(Collection<? extends Geometric> geometrics) { ! Collection<Vertex> vertices = new HashSet<Vertex>(); ! Collection<Edge> edges = new HashSet<Edge>(); ! Collection<Surface> surfaces = new HashSet<Surface>(); for (Geometric current : geometrics) { if (current instanceof Surface) { |
From: rimestad <rim...@us...> - 2007-09-27 10:42:00
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11441/src/net/sourceforge/bprocessor/model Modified Files: Direction.java Log Message: changed toString Index: Direction.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Direction.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Direction.java 30 Aug 2007 13:57:35 -0000 1.14 --- Direction.java 27 Sep 2007 10:41:45 -0000 1.15 *************** *** 116,120 **** */ public String toString() { ! return "[Direction] " + vertex + ", dir: " + direction; } } --- 116,121 ---- */ public String toString() { ! return "[Direction] " + vertex + ", dir: " + direction + ! ", lower: " + lower + ", upper: " + upper; } } |
From: rimestad <rim...@us...> - 2007-09-27 10:41:24
|
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11398/src/net/sourceforge/bprocessor/model Modified Files: CoordinateSystem.java Log Message: Added a method to check if a geometric is in the xy plane of the coordinatesystem Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** CoordinateSystem.java 11 Sep 2007 10:59:59 -0000 1.55 --- CoordinateSystem.java 27 Sep 2007 10:41:25 -0000 1.56 *************** *** 15,18 **** --- 15,20 ---- import java.util.Map; + import org.apache.log4j.Logger; + /** * The CoordinateSystem is represented by *************** *** 25,28 **** --- 27,33 ---- */ public class CoordinateSystem extends Constructor { + /** The logger */ + private static Logger log = Logger.getLogger(CoordinateSystem.class); + /** The i unit vector (x-direction) */ protected Vertex i; *************** *** 67,70 **** --- 72,99 ---- /** + * Check if the given geometry is in the xyplane of the coordinatesystem + * @param g the geometric to check + * @return True if g is in the plane false otherwise + */ + public boolean isInXYPlane(Geometric g) { + if (g instanceof Edge) { + Edge e = (Edge)g; + return isInXYPlane(e.getFrom()) & isInXYPlane(e.getTo()); + } else if (g instanceof Vertex) { + return this.translate((Vertex)g).getZ() == 0.0; + } else if (g instanceof Surface) { + for (Vertex v : ((Surface)g).getVertices()) { + if (!this.isInXYPlane(v)) { + return false; + } + } + return true; + } else { + log.error("The computation of isInXYPlane dont cover " + g.getClass().getSimpleName()); + } + return false; + } + + /** * Returns a CoordinateSystem for the given geometric object. * @param geometric The geometric object to return a CoordinateSystem for |
From: rimestad <rim...@us...> - 2007-09-27 10:40:44
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10990/src/net/sourceforge/bprocessor/gl/tool Modified Files: ControlledMoveTool.java Log Message: some generics on slidemap method Index: ControlledMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/ControlledMoveTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ControlledMoveTool.java 19 Feb 2007 15:50:21 -0000 1.8 --- ControlledMoveTool.java 27 Sep 2007 10:40:38 -0000 1.9 *************** *** 151,159 **** * @return the map, or null if none could be found. */ ! private Map createSlideMap(Surface surface) { Collection verts = surface.getVertices(); Iterator it = verts.iterator(); boolean bound = false; ! Map map = new HashMap(); while (it.hasNext() && !bound) { Vertex vertex = (Vertex)it.next(); --- 151,159 ---- * @return the map, or null if none could be found. */ ! private Map<Vertex, Vertex> createSlideMap(Surface surface) { Collection verts = surface.getVertices(); Iterator it = verts.iterator(); boolean bound = false; ! Map<Vertex, Vertex> map = new HashMap<Vertex, Vertex>(); while (it.hasNext() && !bound) { Vertex vertex = (Vertex)it.next(); *************** *** 176,180 **** it = holes.iterator(); while (it.hasNext() && !bound) { ! Map holeMap = createSlideMap((Surface)it.next()); if (holeMap != null) { map.putAll(holeMap); --- 176,180 ---- it = holes.iterator(); while (it.hasNext() && !bound) { ! Map<Vertex, Vertex> holeMap = createSlideMap((Surface)it.next()); if (holeMap != null) { map.putAll(holeMap); |