bprocessor-commit Mailing List for B-processor (Page 76)
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: Nordholt <nor...@us...> - 2007-02-16 13:33:43
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29701/src/net/sourceforge/bprocessor/facade/modellor Modified Files: NetFacadeModellor.java Log Message: some ajustments of the net facade Index: NetFacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/NetFacadeModellor.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** NetFacadeModellor.java 16 Feb 2007 09:57:55 -0000 1.17 --- NetFacadeModellor.java 16 Feb 2007 13:33:42 -0000 1.18 *************** *** 255,259 **** */ public Net getNet() { ! return net; } --- 255,259 ---- */ public Net getNet() { ! return this.net; } *************** *** 264,268 **** public void setNet(Space net) { if (this.net != null) { ! space.remove(net); } this.net = (Net)net; --- 264,268 ---- public void setNet(Space net) { if (this.net != null) { ! space.remove(this.net); } this.net = (Net)net; *************** *** 297,306 **** space.clear(); frame = null; ! space.add(net); ! prepareNet(net); if (single) { ! createSingleFacade(net); } else { ! createDoubleFacade(net); } } --- 297,306 ---- space.clear(); frame = null; ! space.add(getNet()); ! prepareNet(getNet()); if (single) { ! createSingleFacade(getNet()); } else { ! createDoubleFacade(getNet()); } } *************** *** 434,442 **** private void detailField(Map envF, Surface hole) { double frameSize = 0.0; if (envF.get("type") instanceof Selector) { Selector sel = (Selector)envF.get("type"); ! if (sel.getCurrentValue().equals("Window")) { frameSize = WINDOW_FRAME; ! } else if (sel.getCurrentValue().equals("Door")) { frameSize = DOOR_FRAME; } --- 434,444 ---- private void detailField(Map envF, Surface hole) { double frameSize = 0.0; + String type = ""; if (envF.get("type") instanceof Selector) { Selector sel = (Selector)envF.get("type"); ! type = sel.getCurrentValue().toString(); ! if (type.equals("Window")) { frameSize = WINDOW_FRAME; ! } else if (type.equals("Door")) { frameSize = DOOR_FRAME; } *************** *** 460,464 **** Geometry.holeAnalysis(out); ! Space f = new Space(envF.get("type") + " Frame", Space.CONSTRUCTION, Space.ELEMENT_LEVEL, --- 462,466 ---- Geometry.holeAnalysis(out); ! Space f = new Space(type + " Frame", Space.CONSTRUCTION, Space.ELEMENT_LEVEL, *************** *** 479,490 **** assignSame(front, inEx, space, frame); Geometry.holeAnalysis(inEx); ! ! sides = new HashSet(); ! Surface outEx = extrudeIntoSpace(out, FRAME_DEPTH, sides); ! //outEx = space.insert(outEx); ! assignOpposite(front, outEx, space, g); assignOpposite(front, hole, space, f); - - Geometry.holeAnalysis(outEx); Geometry.holeAnalysis(hole); } --- 481,486 ---- assignSame(front, inEx, space, frame); Geometry.holeAnalysis(inEx); ! assignOpposite(front, hole, space, f); Geometry.holeAnalysis(hole); } *************** *** 526,530 **** next = (Edge)e; done = true; ! } } if (next != null) { --- 522,526 ---- next = (Edge)e; done = true; ! } } if (next != null) { *************** *** 543,547 **** return outline; } else { ! log.warn("Outline not well defined"); } } --- 539,545 ---- return outline; } else { ! log.warn("Outline not well defined, " + ! " all outer edges in outline: " + outer.size() + ! " outline connected: " + first.getFrom().getEdges().contains(outline.getLast())); } } *************** *** 557,561 **** Net n = new Net("Facade net"); if (front != null) { ! front.copyall(n); } return n; --- 555,559 ---- Net n = new Net("Facade net"); if (front != null) { ! front.copy(n); } return n; *************** *** 576,579 **** --- 574,578 ---- public void setFront(Surface front) { this.front = front; + setNet(createNet(front)); } *************** *** 608,612 **** space.add(surface); } - space.add(top); return top; } --- 607,610 ---- |
|
From: Nordholt <nor...@us...> - 2007-02-16 10:37:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28298/src/net/sourceforge/bprocessor/model Modified Files: Geometry.java Log Message: warning when NaN is rounded Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** Geometry.java 31 Jan 2007 09:18:30 -0000 1.44 --- Geometry.java 16 Feb 2007 09:29:26 -0000 1.45 *************** *** 33,36 **** --- 33,40 ---- */ public static double round(double value) { + if (Double.isNaN(value)) { + log.warn("asked to round NaN"); + return Double.NaN; + } double factor = 10000000000.0; double d = value * factor; *************** *** 279,284 **** Collection<Surface> surfaces = surface.getOwner().getSurfaces(); Collection<Surface> envelope = surface.getOwner().getEnvelope(); - candidates.addAll(surfaces); candidates.addAll(envelope); for (Surface current : candidates) { --- 283,288 ---- Collection<Surface> surfaces = surface.getOwner().getSurfaces(); Collection<Surface> envelope = surface.getOwner().getEnvelope(); candidates.addAll(envelope); + candidates.addAll(surfaces); for (Surface current : candidates) { |
|
From: Nordholt <nor...@us...> - 2007-02-16 10:37:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28265/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Log Message: safty check Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** Edge.java 22 Jan 2007 15:40:16 -0000 1.71 --- Edge.java 16 Feb 2007 09:28:35 -0000 1.72 *************** *** 697,701 **** Line l1 = new Line(org1, dir1); Line l2 = new Line(org2, dir2); ! mainDir = work.minus(l1.intersection(l2)); } else { //If the edges are parallel the offset must be the same --- 697,708 ---- Line l1 = new Line(org1, dir1); Line l2 = new Line(org2, dir2); ! Vertex intersect = l1.intersection(l2); ! if (intersect != null) { ! mainDir = work.minus(intersect); ! } else { ! log.warn("offset lines does not intersect," + ! " l1: " + l1 + " l2: " + l2); ! mainDir = new Vertex(0, 0, 0); ! } } else { //If the edges are parallel the offset must be the same |
|
From: Nordholt <nor...@us...> - 2007-02-16 09:57:56
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6858/src/net/sourceforge/bprocessor/facade/modellor Modified Files: NetFacadeModellor.java Log Message: uses the extrusion method instead of extrude. Did some other refactoring Index: NetFacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/NetFacadeModellor.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** NetFacadeModellor.java 7 Feb 2007 16:59:22 -0000 1.16 --- NetFacadeModellor.java 16 Feb 2007 09:57:55 -0000 1.17 *************** *** 36,39 **** --- 36,51 ---- */ public class NetFacadeModellor extends Modellor { + /** Thickness of a generic door frame */ + private static final double DOOR_FRAME = 0.12; + + /** Thickness of a generic window frame */ + private static final double WINDOW_FRAME = 0.05; + + /** identation of the window and door frames into the main frame*/ + private static final double FRAME_IDENTATION = 0.02; + + /** The depth of window and door frames */ + private static final double FRAME_DEPTH = 0.05; + /** serial id */ private static final long serialVersionUID = 1L; *************** *** 208,216 **** while (sit.hasNext()) { Surface s = (Surface)sit.next(); ! if (s.getName().equals(att.getValue())) { ! if (front != s) { ! this.setFront(s); ! this.setNet(createNet(front)); ! } } } --- 220,226 ---- while (sit.hasNext()) { Surface s = (Surface)sit.next(); ! if (s.getName().equals(att.getValue()) && front != s) { ! this.setFront(s); ! this.setNet(createNet(front)); } } *************** *** 316,320 **** if (env.get("type") == null) { List options = new LinkedList(); - options.add("Empty"); options.add("Glass"); options.add("Window"); --- 326,329 ---- *************** *** 378,385 **** outlineCopies.add(((Edge)it.next()).copy()); } ! if (!outlineCopies.isEmpty()) { /* make the shell of the facade */ Surface frameSurface = new Surface(outlineCopies); ! space.insert(frameSurface); assignSame(front, frameSurface, space, frame); Set sides1 = new HashSet(); --- 387,394 ---- outlineCopies.add(((Edge)it.next()).copy()); } ! if (!outlineCopies.isEmpty()) { /* make the shell of the facade */ Surface frameSurface = new Surface(outlineCopies); ! frameSurface = space.insert(frameSurface); assignSame(front, frameSurface, space, frame); Set sides1 = new HashSet(); *************** *** 404,476 **** } } Surface hole = new Surface(Edge.placeOffset(field.getEdges(), field, offsetMap)); hole = space.insert(hole); Geometry.holeAnalysis(hole); Set sides2 = new HashSet(); Surface holeEx = space.insert(extrudeIntoSpace(hole, depth, sides2)); Geometry.holeAnalysis(holeEx); ! Double extraFrame = 0.0; ! if (envF.get("type") instanceof Selector) { ! Selector sel = (Selector)envF.get("type"); ! if (sel.getCurrentValue().equals("Empty")) { ! extraFrame = 0.0; ! } else if (sel.getCurrentValue().equals("Glass")) { ! extraFrame = 0.0; ! } else if (sel.getCurrentValue().equals("Window")) { ! extraFrame = 0.05; ! } else if (sel.getCurrentValue().equals("Door")) { ! extraFrame = 0.12; ! } ! } ! if (extraFrame > 0) { ! Map offmap1 = new HashMap<Edge, Double>(); ! Map offmap2 = new HashMap<Edge, Double>(); ! for (Object o : hole.getEdges()) { ! Edge e = (Edge)o; ! offmap1.put(e, 0.02); ! offmap2.put(e, -(extraFrame - 0.02)); ! } ! Surface in = new Surface(Edge.placeOffset(hole.getEdges(), hole, offmap1)); ! Surface out = new Surface(Edge.placeOffset(hole.getEdges(), hole, offmap2)); ! hole.getExterior().removeHole(hole); ! pushIntoSpace(hole, 0.05); ! Geometry.holeAnalysis(hole); ! in = space.insert(in); ! out = space.insert(out); ! Geometry.holeAnalysis(in); ! Geometry.holeAnalysis(out); ! ! Space wf = new Space("Window Frame", ! Space.CONSTRUCTION, ! Space.ELEMENT_LEVEL, ! true); ! Space g = new Space("Glass", ! Space.CONSTRUCTION, ! Space.ELEMENT_LEVEL, ! true); ! g.setTransparent(true); ! space.add(g); ! space.add(wf); ! assignSame(front, in, space, wf); ! assignSame(front, out, space, g); ! ! Set sides = new HashSet(); ! Surface inEx = extrudeIntoSpace(in, 0.05, sides); ! assignSame(front, inEx, space, frame); ! space.add(inEx); ! assignSame(front, inEx, space, frame); ! Geometry.holeAnalysis(inEx); ! sides = new HashSet(); ! Surface outEx = extrudeIntoSpace(out, 0.05, sides); ! outEx = space.insert(outEx); ! assignOpposite(front, outEx, space, g); ! assignOpposite(front, hole, space, wf); ! Geometry.holeAnalysis(outEx); ! Geometry.holeAnalysis(hole); ! } } } } } /** --- 413,493 ---- } } + Surface hole = new Surface(Edge.placeOffset(field.getEdges(), field, offsetMap)); hole = space.insert(hole); Geometry.holeAnalysis(hole); + Set sides2 = new HashSet(); Surface holeEx = space.insert(extrudeIntoSpace(hole, depth, sides2)); Geometry.holeAnalysis(holeEx); ! detailField(envF, hole); } } } } + + /** + * Generates door or window frames in the field + * @param envF the parameters for the field + * @param hole the hole in the frame for the field + */ + private void detailField(Map envF, Surface hole) { + double frameSize = 0.0; + if (envF.get("type") instanceof Selector) { + Selector sel = (Selector)envF.get("type"); + if (sel.getCurrentValue().equals("Window")) { + frameSize = WINDOW_FRAME; + } else if (sel.getCurrentValue().equals("Door")) { + frameSize = DOOR_FRAME; + } + } + if (frameSize > 0) { + Map offmap1 = new HashMap<Edge, Double>(); + Map offmap2 = new HashMap<Edge, Double>(); + for (Object o : hole.getEdges()) { + Edge e = (Edge)o; + offmap1.put(e, FRAME_IDENTATION); + offmap2.put(e, -(frameSize - FRAME_IDENTATION)); + } + Surface in = new Surface(Edge.placeOffset(hole.getEdges(), hole, offmap1)); + Surface out = new Surface(Edge.placeOffset(hole.getEdges(), hole, offmap2)); + hole.getExterior().removeHole(hole); + pushIntoSpace(hole, FRAME_DEPTH); + Geometry.holeAnalysis(hole); + in = space.insert(in); + out = space.insert(out); + Geometry.holeAnalysis(in); + Geometry.holeAnalysis(out); + + Space f = new Space(envF.get("type") + " Frame", + Space.CONSTRUCTION, + Space.ELEMENT_LEVEL, + true); + Space g = new Space("Glass", + Space.CONSTRUCTION, + Space.ELEMENT_LEVEL, + true); + g.setTransparent(true); + space.add(g); + space.add(f); + assignSame(front, in, space, f); + assignSame(front, out, space, g); + + Set sides = new HashSet(); + Surface inEx = extrudeIntoSpace(in, FRAME_DEPTH, sides); + space.add(inEx); + assignSame(front, inEx, space, frame); + Geometry.holeAnalysis(inEx); + + sides = new HashSet(); + Surface outEx = extrudeIntoSpace(out, FRAME_DEPTH, sides); + //outEx = space.insert(outEx); + assignOpposite(front, outEx, space, g); + assignOpposite(front, hole, space, f); + + Geometry.holeAnalysis(outEx); + Geometry.holeAnalysis(hole); + } + } /** *************** *** 485,489 **** /*Find outer edges*/ Iterator edges = net.getEdges().iterator(); ! Set outer = new HashSet(); while (edges.hasNext()) { Edge current = (Edge)edges.next(); --- 502,506 ---- /*Find outer edges*/ Iterator edges = net.getEdges().iterator(); ! Set<Edge> outer = new HashSet<Edge>(); while (edges.hasNext()) { Edge current = (Edge)edges.next(); *************** *** 494,498 **** /*If there are outer edges sort them in order*/ if (!outer.isEmpty()) { ! LinkedList outline = new LinkedList(); Edge first = (Edge)outer.iterator().next(); outline.add(first); --- 511,515 ---- /*If there are outer edges sort them in order*/ if (!outer.isEmpty()) { ! LinkedList<Edge> outline = new LinkedList<Edge>(); Edge first = (Edge)outer.iterator().next(); outline.add(first); *************** *** 577,581 **** deltaCorrection *= -1; } ! return s.extrude(delta * deltaCorrection, sides); } --- 594,613 ---- deltaCorrection *= -1; } ! Set tops = new HashSet(); ! Surface top = s.extrusionall(delta * deltaCorrection, sides, tops); ! ! tops.addAll(sides); ! for (Object o1 : tops) { ! Surface surface = (Surface)o1; ! for (Object o2 : surface.getEdges()) { ! Edge edge = (Edge)o2; ! space.add(edge.getTo()); ! space.add(edge.getFrom()); ! space.add(edge); ! } ! space.add(surface); ! } ! space.add(top); ! return top; } |
|
From: Nordholt <nor...@us...> - 2007-02-16 09:56:55
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attributesview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6468/src/net/sourceforge/bprocessor/gui/attributesview Modified Files: AttributesPanel.java Log Message: added logger and some comments Index: AttributesPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attributesview/AttributesPanel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AttributesPanel.java 5 Jan 2006 13:48:06 -0000 1.2 --- AttributesPanel.java 16 Feb 2007 09:56:42 -0000 1.3 *************** *** 21,24 **** --- 21,26 ---- import javax.swing.JPanel; + import org.apache.log4j.Logger; + /** * The AttributesPanel contains a list of attributes each represented by *************** *** 26,29 **** --- 28,39 ---- */ public class AttributesPanel extends JPanel implements MouseListener { + /** + * serial UID + */ + private static final long serialVersionUID = 1L; + + /** The logger */ + private static Logger log = Logger.getLogger(AttributesPanel.class); + /** The value font */ public static final Font VALUE_FONT = new Font("Sans-serif", Font.PLAIN, 12); *************** *** 88,92 **** current = view; if (current != null) { ! view.startEditing(); } } --- 98,102 ---- current = view; if (current != null) { ! current.startEditing(); } } |
|
From: Nordholt <nor...@us...> - 2007-02-16 09:56:44
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6468/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: added logger and some comments Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** PopupMenu.java 31 Jan 2007 21:00:30 -0000 1.25 --- PopupMenu.java 16 Feb 2007 09:56:42 -0000 1.26 *************** *** 81,85 **** }; jm.add(focus); ! } if (c.size() == 2) { JMenuItem offsetItem = new JMenuItem("Offset Constraint"); --- 81,85 ---- }; jm.add(focus); ! } if (c.size() == 2) { JMenuItem offsetItem = new JMenuItem("Offset Constraint"); *************** *** 94,98 **** ); jm.add(offsetItem); ! } return jm; } --- 94,99 ---- ); jm.add(offsetItem); ! } ! return jm; } *************** *** 220,223 **** --- 221,226 ---- Project p = Project.getInstance(); space.edit(); + //FIXME: changed is also called in the edit-method on space + //It is properly only needed once. p.changed(p); } |
|
From: Nordholt <nor...@us...> - 2007-02-16 09:50:40
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4136/src/net/sourceforge/bprocessor/model/test Modified Files: LineTest.java Log Message: added testcase Index: LineTest.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/test/LineTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** LineTest.java 18 Sep 2006 14:36:50 -0000 1.5 --- LineTest.java 16 Feb 2007 09:50:38 -0000 1.6 *************** *** 88,91 **** --- 88,92 ---- public void testIntersection() { { + //simple test Vertex o1 = new Vertex(0, 1, 0); Vertex d1 = new Vertex(0, 0, 1); *************** *** 100,103 **** --- 101,105 ---- } { + //simple test Vertex o1 = new Vertex(0.5, 0.86734, 0); Vertex d1 = new Vertex(0, 0, 1); *************** *** 111,115 **** Vertex iActual = l1.intersection(l2); assertTrue(iTrue.equalEps(iActual)); ! } } } --- 113,157 ---- Vertex iActual = l1.intersection(l2); assertTrue(iTrue.equalEps(iActual)); ! } ! { ! //same origin ! Vertex o1 = new Vertex(0, 0, 0); ! Vertex d1 = new Vertex(0, 0, -1); ! Line l1 = new Line(o1, d1); ! ! Vertex o2 = new Vertex(0, 0, 0); ! Vertex d2 = new Vertex(0, 1, 0); ! Line l2 = new Line(o2, d2); ! ! Vertex i = new Vertex(0, 0, 0); ! assertTrue(l1.intersection(l2).equalEps(i)); ! } ! { ! //same direction - coinciding ! Vertex o1 = new Vertex(0, 0, 0); ! Vertex d1 = new Vertex(0, 0, -1); ! Line l1 = new Line(o1, d1); ! ! Vertex o2 = new Vertex(0, 0, 0); ! Vertex d2 = new Vertex(0, 0, -1); ! Line l2 = new Line(o2, d2); ! ! assertTrue(l1.intersection(l2) == null); ! } ! { ! //same direction - parrallel ! Vertex o1 = new Vertex(0, 0, 0); ! Vertex d1 = new Vertex(0, 0, -1); ! Line l1 = new Line(o1, d1); ! ! Vertex o2 = new Vertex(0, 1, 2); ! Vertex d2 = new Vertex(0, 0, -1); ! Line l2 = new Line(o2, d2); ! ! assertTrue(l1.intersection(l2) == null); ! } ! ! ! } } |
|
From: Nordholt <nor...@us...> - 2007-02-16 09:50:28
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4082/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: fixed normal calculation Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** Surface.java 13 Feb 2007 15:05:14 -0000 1.136 --- Surface.java 16 Feb 2007 09:50:21 -0000 1.137 *************** *** 596,600 **** vertices.toArray(v); edges.toArray(e); ! for (int i = 0; i < n; i++) { vmap[i] = v[i].copy().add(normal); --- 596,600 ---- vertices.toArray(v); edges.toArray(e); ! for (int i = 0; i < n; i++) { vmap[i] = v[i].copy().add(normal); *************** *** 630,640 **** 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(); --- 630,639 ---- 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(); *************** *** 1112,1117 **** hole.setBackDomain(back); } - //changed(); - //hole.changed(); } --- 1111,1114 ---- *************** *** 1149,1177 **** } } - /* NOT THE JOB FOR SURFACE - if (exterior != null) { - if (!exterior.surrounds(this)) { - log.info("Did move the surface back"); - //The inner surface has been moved out of its outer surface - //this can not happen so here we move the inner surface back - { - List vertices = getVertices(); - Iterator iter = vertices.iterator(); - while (iter.hasNext()) { - Vertex vertex = (Vertex) iter.next(); - vertex.move(-dx, -dy, -dz); - } - } - { - if (getHoles() != null) { - Iterator iter = getHoles().iterator(); - while (iter.hasNext()) { - Surface surface = (Surface) iter.next(); - surface.move(-dx, -dy, -dz); - } - } - } - } - }*/ } --- 1146,1149 ---- *************** *** 1418,1422 **** public Vertex normal() { return normal0(); - //return Geometry.normal(getVertices()); } --- 1390,1393 ---- *************** *** 1468,1471 **** --- 1439,1443 ---- } } + double[] coord; if (y > x) { *************** *** 1490,1496 **** } } ! int inx0 = inx1 == 0 ? e.length - 1 : inx1 - 1; int inx2 = (inx1 + 1) % e.length; vx = xs[inx1] - xs[inx0]; vy = ys[inx1] - ys[inx0]; --- 1462,1476 ---- } } ! ! int inx0 = inx1 == 0 ? e.length - 1 : inx1 - 1; int inx2 = (inx1 + 1) % e.length; + for (int i = 0; i < e.length; i++) { + if (coord[inx1] < coord[(inx2 + i) % e.length]) { + inx2 = (inx2 + i) % e.length; + break; + } + } + vx = xs[inx1] - xs[inx0]; vy = ys[inx1] - ys[inx0]; *************** *** 1508,1512 **** y = y / length; z = z / length; - return new Vertex(x, y, z); } --- 1488,1491 ---- |
|
From: Nordholt <nor...@us...> - 2007-02-16 09:47:51
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2932/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Log Message: deleted rouge tab character Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** Edge.java 16 Feb 2007 09:28:35 -0000 1.72 --- Edge.java 16 Feb 2007 09:47:43 -0000 1.73 *************** *** 702,706 **** } else { log.warn("offset lines does not intersect," + ! " l1: " + l1 + " l2: " + l2); mainDir = new Vertex(0, 0, 0); } --- 702,706 ---- } else { log.warn("offset lines does not intersect," + ! " l1: " + l1 + " l2: " + l2); mainDir = new Vertex(0, 0, 0); } |
|
From: Michael L. <he...@us...> - 2007-02-15 15:12:18
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10428/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: More refactoring Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.186 retrieving revision 1.187 diff -C2 -d -r1.186 -r1.187 *** View.java 15 Feb 2007 14:57:37 -0000 1.186 --- View.java 15 Feb 2007 15:12:13 -0000 1.187 *************** *** 1187,1190 **** --- 1187,1203 ---- } + + private void drawConstructors(Collection<Constructor> constructors) { + Camera camera = Project.getInstance().getCurrentCamera(); + for (Constructor constructor : constructors) { + double dist = camera.distance(constructor.getOrigin()); + if (target != constructor && !highligts.contains(constructor)) { + if (constructor != Project.getInstance().getActiveCoordinateSystem()) { + drawGeneralConstructor(constructor, dist, true, OBJECTS); + } + } + } + } + /** * Draw all constructors in this level and all above *************** *** 1209,1220 **** transformTo(active); Collection<Constructor> constructors = active.getConstructors(); ! for (Constructor constructor : constructors) { ! double dist = camera.distance(constructor.getOrigin()); ! if (target != constructor && !highligts.contains(constructor)) { ! if (constructor != Project.getInstance().getActiveCoordinateSystem()) { ! drawGeneralConstructor(constructor, dist, true, OBJECTS); ! } ! } ! } gl.glPopMatrix(); } else { --- 1222,1226 ---- transformTo(active); Collection<Constructor> constructors = active.getConstructors(); ! drawConstructors(constructors); gl.glPopMatrix(); } else { *************** *** 1223,1235 **** active = active.getOwner(); } ! Iterator iter = tempConstructors.iterator(); ! while (iter.hasNext()) { ! Constructor constructor = (Constructor)iter.next(); ! double dist = camera.distance(constructor.getOrigin()); ! drawGeneralConstructor(constructor, dist, true, OBJECTS); ! } enableClipplanes(); } ! /** * FIXME edge-drawing --- 1229,1236 ---- active = active.getOwner(); } ! drawConstructors(tempConstructors); enableClipplanes(); } ! /** * FIXME edge-drawing |
|
From: Michael L. <he...@us...> - 2007-02-15 14:57:56
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3288/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Log Message: Refactored camera-code Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Camera.java 31 Jan 2007 21:27:30 -0000 1.36 --- Camera.java 15 Feb 2007 14:57:41 -0000 1.37 *************** *** 347,351 **** invertFactor(); } ! } /** --- 347,369 ---- invertFactor(); } ! } ! ! /** ! * Calculate an adjusted distance from this Camera to ! * the vertex. ! * @param vertex the vertex to calculate an adjusted distance to. ! * @return return the adjusted distance. ! */ ! public double distance(Vertex vertex) { ! Vertex eye = new Vertex(getCamera()); ! double scale = (getFocalwidth() / 65); ! double dist = 0.0; ! if (getType() == Camera.PERSPECTIVE) { ! dist = eye.distance(vertex); ! } else { ! dist = eye.distance(new Vertex(getCenter())); ! } ! return dist * scale / 16; ! } /** |
|
From: Michael L. <he...@us...> - 2007-02-15 14:57:54
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3279/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Refactored camera-code Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.185 retrieving revision 1.186 diff -C2 -d -r1.185 -r1.186 *** View.java 14 Feb 2007 14:40:28 -0000 1.185 --- View.java 15 Feb 2007 14:57:37 -0000 1.186 *************** *** 1068,1102 **** gl.glPushMatrix(); transform(space.getTransformations()); ! Collection surfaces = space.getSurfaces(); ! switch (drawMode) { ! case LIGHTING_MODE: { ! gl.glEnable(GL.GL_LIGHTING); ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(0.5f, 0.5f); ! gl.glEnable(GL.GL_CULL_FACE); ! gl.glCullFace(GL.GL_BACK); ! drawSurfaces(surfaces, FRONT, !active); ! gl.glCullFace(GL.GL_FRONT); ! drawSurfaces(surfaces, BACK, !active); ! gl.glDisable(GL.GL_CULL_FACE); ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glDisable(GL.GL_LIGHTING); ! break; ! } ! case WIREFRAME_MODE: { ! // NOTHING TO DO ! break; ! } ! case SOLID_MODE: { ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(1.0f, 1.0f); ! gl.glColor3fv(SURFACE_COLOR, 0); ! drawSurfaces(surfaces, BOTH, !active); ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); ! break; ! } } if (doDrawEdges) { --- 1068,1104 ---- gl.glPushMatrix(); transform(space.getTransformations()); ! if (active) { ! Collection surfaces = space.getSurfaces(); ! switch (drawMode) { ! case LIGHTING_MODE: { ! gl.glEnable(GL.GL_LIGHTING); ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(0.5f, 0.5f); ! gl.glEnable(GL.GL_CULL_FACE); ! gl.glCullFace(GL.GL_BACK); ! drawSurfaces(surfaces, FRONT); ! gl.glCullFace(GL.GL_FRONT); ! drawSurfaces(surfaces, BACK); ! gl.glDisable(GL.GL_CULL_FACE); ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glDisable(GL.GL_LIGHTING); ! break; ! } ! case WIREFRAME_MODE: { ! // NOTHING TO DO ! break; ! } ! case SOLID_MODE: { ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(1.0f, 1.0f); ! gl.glColor3fv(SURFACE_COLOR, 0); ! drawSurfaces(surfaces, BOTH); ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); ! break; ! } ! } } if (doDrawEdges) { *************** *** 1162,1171 **** Constructor c = (Constructor) o; Camera camera = Project.getInstance().getCurrentCamera(); ! Vertex v = new Vertex(camera.getCamera()); ! double scale = (camera.getFocalwidth() / 65); ! double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; ! if (camera.getType() == Camera.PERSPECTIVE) { ! dist = (c.getOrigin().minus(v)).length() * scale; ! } drawGeneralConstructor(c, dist, false, OBJECTS); } --- 1164,1168 ---- Constructor c = (Constructor) o; Camera camera = Project.getInstance().getCurrentCamera(); ! double dist = camera.distance(c.getOrigin()); drawGeneralConstructor(c, dist, false, OBJECTS); } *************** *** 1197,1207 **** Space active = Project.getInstance().getActiveSpace(); Camera camera = Project.getInstance().getCurrentCamera(); ! Vertex v = new Vertex(camera.getCamera()); ! double scale = (camera.getFocalwidth() / 65); ! double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; if (active != null) { gl.glPushMatrix(); transformTo(active); ! dist = v.distance(Project.getInstance().getActiveCoordinateSystem().center()) * scale; drawGeneralConstructor(Project.getInstance().getActiveCoordinateSystem(), dist, true, OBJECTS); --- 1194,1202 ---- Space active = Project.getInstance().getActiveSpace(); Camera camera = Project.getInstance().getCurrentCamera(); ! if (active != null) { gl.glPushMatrix(); transformTo(active); ! double dist = camera.distance(Project.getInstance().getActiveCoordinateSystem().center()); drawGeneralConstructor(Project.getInstance().getActiveCoordinateSystem(), dist, true, OBJECTS); *************** *** 1213,1227 **** gl.glPushMatrix(); transformTo(active); ! Collection cons = active.getConstructors(); ! Iterator iter = cons.iterator(); ! while (iter.hasNext()) { ! Object o = iter.next(); ! Constructor c = (Constructor)o; ! if (camera.getType() == Camera.PERSPECTIVE) { ! dist = (c.getOrigin().distance(v)) * scale; ! } ! if (target != c && !highligts.contains(c)) { ! if (c != Project.getInstance().getActiveCoordinateSystem()) { ! drawGeneralConstructor(c, dist, true, OBJECTS); } } --- 1208,1217 ---- gl.glPushMatrix(); transformTo(active); ! Collection<Constructor> constructors = active.getConstructors(); ! for (Constructor constructor : constructors) { ! double dist = camera.distance(constructor.getOrigin()); ! if (target != constructor && !highligts.contains(constructor)) { ! if (constructor != Project.getInstance().getActiveCoordinateSystem()) { ! drawGeneralConstructor(constructor, dist, true, OBJECTS); } } *************** *** 1235,1243 **** Iterator iter = tempConstructors.iterator(); while (iter.hasNext()) { ! Constructor c = (Constructor)iter.next(); ! if (camera.getType() == Camera.PERSPECTIVE) { ! dist = (c.getOrigin().distance(v)) * scale; ! } ! drawGeneralConstructor(c, dist, true, OBJECTS); } enableClipplanes(); --- 1225,1231 ---- Iterator iter = tempConstructors.iterator(); while (iter.hasNext()) { ! Constructor constructor = (Constructor)iter.next(); ! double dist = camera.distance(constructor.getOrigin()); ! drawGeneralConstructor(constructor, dist, true, OBJECTS); } enableClipplanes(); *************** *** 1265,1272 **** Line l = (Line)constructor; if (l.isEditable()) { ! drawVector(l.getOrigin(), l.tip(dist / 16)); } if (l.isActive()) { ! drawConstructorLine(l.getOrigin(), l.getDirection(), dist); } } else if (constructor instanceof CoordinateSystem) { --- 1253,1260 ---- Line l = (Line)constructor; if (l.isEditable()) { ! drawVector(l.getOrigin(), l.tip(dist)); } if (l.isActive()) { ! drawConstructorLine(l.getOrigin(), l.getDirection()); } } else if (constructor instanceof CoordinateSystem) { *************** *** 1326,1330 **** } if (cs.isActive() && active) { ! drawConstructorLine(cs.getOrigin(), i, dist); } if (cs.isEditable()) { --- 1314,1318 ---- } if (cs.isActive() && active) { ! drawConstructorLine(cs.getOrigin(), i); } if (cs.isEditable()) { *************** *** 1332,1336 **** } if (cs.isActive() && active) { ! drawConstructorLine(cs.getOrigin(), j, dist); } active = false; --- 1320,1324 ---- } if (cs.isActive() && active) { ! drawConstructorLine(cs.getOrigin(), j); } active = false; *************** *** 1364,1368 **** } if (cs.isActive() && active) { ! drawConstructorLine(cs.getOrigin(), i, dist); } if (colorize) { --- 1352,1356 ---- } if (cs.isActive() && active) { ! drawConstructorLine(cs.getOrigin(), i); } if (colorize) { *************** *** 1373,1377 **** } if (cs.isActive() && active) { ! drawConstructorLine(cs.getOrigin(), j, dist); } Vertex n = cs.getN(); --- 1361,1365 ---- } if (cs.isActive() && active) { ! drawConstructorLine(cs.getOrigin(), j); } Vertex n = cs.getN(); *************** *** 1383,1387 **** } if (cs.isActive() && active) { ! drawConstructorLine(cs.getOrigin(), n, dist); } } --- 1371,1375 ---- } if (cs.isActive() && active) { ! drawConstructorLine(cs.getOrigin(), n); } } *************** *** 1408,1412 **** private void drawConstructorVector(Vertex from, Vertex direction, double dist) { Vertex d = direction.copy(); ! d.scale(dist / 16); Vertex to = from.add(d); drawVectorBase(from, to); --- 1396,1400 ---- private void drawConstructorVector(Vertex from, Vertex direction, double dist) { Vertex d = direction.copy(); ! d.scale(dist); Vertex to = from.add(d); drawVectorBase(from, to); *************** *** 1465,1472 **** * @param dist Dist */ ! private void drawConstructorLine(Vertex from, Vertex direction, double dist) { gl.glLineWidth(1.0f); gl.glEnable(GL.GL_LINE_STIPPLE); ! drawConstructorLineGeometry(from, direction, dist); gl.glDisable(GL.GL_LINE_STIPPLE); } --- 1453,1460 ---- * @param dist Dist */ ! private void drawConstructorLine(Vertex from, Vertex direction) { gl.glLineWidth(1.0f); gl.glEnable(GL.GL_LINE_STIPPLE); ! drawConstructorLineGeometry(from, direction); gl.glDisable(GL.GL_LINE_STIPPLE); } *************** *** 1477,1483 **** * @param from Origin * @param direction Direction vector - * @param dist Dist */ ! private void drawConstructorLineGeometry(Vertex from, Vertex direction, double dist) { Vertex dir = direction.copy(); dir.scale(View.gridSize() * 2); --- 1465,1470 ---- * @param from Origin * @param direction Direction vector */ ! private void drawConstructorLineGeometry(Vertex from, Vertex direction) { Vertex dir = direction.copy(); dir.scale(View.gridSize() * 2); *************** *** 1556,1566 **** * @param surfaces The surfaces to draw * @param side The side of the Surface to draw - * @param dodge dodge colors */ ! private void drawSurfaces(Collection surfaces, int side, boolean dodge) { Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); ! if (!hide(s) && !dodge) { boolean visible = isVisible(s); --- 1543,1552 ---- * @param surfaces The surfaces to draw * @param side The side of the Surface to draw */ ! private void drawSurfaces(Collection surfaces, int side) { Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface s = (Surface)it.next(); ! if (!hide(s)) { boolean visible = isVisible(s); |
|
From: Michael L. <he...@us...> - 2007-02-14 14:40:41
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24042/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Renamed dodge to active Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.184 retrieving revision 1.185 diff -C2 -d -r1.184 -r1.185 *** View.java 14 Feb 2007 14:27:24 -0000 1.184 --- View.java 14 Feb 2007 14:40:28 -0000 1.185 *************** *** 903,907 **** } ! drawSpace(Project.getInstance().world(), true); //Draw edges --- 903,907 ---- } ! drawSpace(Project.getInstance().world(), false); //Draw edges *************** *** 1060,1068 **** * Draw space * @param space The Space ! * @param dodge dodge the colors */ ! private void drawSpace(Space space, boolean dodge) { if (space == Project.getInstance().getActiveSpace()) { ! dodge = false; } gl.glPushMatrix(); --- 1060,1068 ---- * Draw space * @param space The Space ! * @param active inside active space */ ! private void drawSpace(Space space, boolean active) { if (space == Project.getInstance().getActiveSpace()) { ! active = true; } gl.glPushMatrix(); *************** *** 1077,1084 **** gl.glCullFace(GL.GL_BACK); ! drawSurfaces(surfaces, FRONT, dodge); gl.glCullFace(GL.GL_FRONT); ! drawSurfaces(surfaces, BACK, dodge); gl.glDisable(GL.GL_CULL_FACE); --- 1077,1084 ---- gl.glCullFace(GL.GL_BACK); ! drawSurfaces(surfaces, FRONT, !active); gl.glCullFace(GL.GL_FRONT); ! drawSurfaces(surfaces, BACK, !active); gl.glDisable(GL.GL_CULL_FACE); *************** *** 1095,1099 **** gl.glPolygonOffset(1.0f, 1.0f); gl.glColor3fv(SURFACE_COLOR, 0); ! drawSurfaces(surfaces, BOTH, dodge); gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); break; --- 1095,1099 ---- gl.glPolygonOffset(1.0f, 1.0f); gl.glColor3fv(SURFACE_COLOR, 0); ! drawSurfaces(surfaces, BOTH, !active); gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); break; *************** *** 1101,1105 **** } if (doDrawEdges) { ! drawGeneralEdges(space.getEdges(), dodge); } Collection elements = space.getElements(); --- 1101,1105 ---- } if (doDrawEdges) { ! drawGeneralEdges(space.getEdges(), !active); } Collection elements = space.getElements(); *************** *** 1107,1111 **** while (iter.hasNext()) { Space current = (Space) iter.next(); ! drawSpace(current, dodge); } gl.glPopMatrix(); --- 1107,1111 ---- while (iter.hasNext()) { Space current = (Space) iter.next(); ! drawSpace(current, active); } gl.glPopMatrix(); |
|
From: Michael L. <he...@us...> - 2007-02-14 14:27:32
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17746/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Refactoring draw code Ð removed usage of gld Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.183 retrieving revision 1.184 diff -C2 -d -r1.183 -r1.184 *** View.java 14 Feb 2007 11:41:57 -0000 1.183 --- View.java 14 Feb 2007 14:27:24 -0000 1.184 *************** *** 357,363 **** private Set tempVertices; - /** Entities that should be drawn on top of everything else*/ - private Set onTopEntities; - /** Maps entities to a color */ private Map colorMap; --- 357,360 ---- *************** *** 382,388 **** private int maxClippingPlanes; - /** */ - private static final boolean DRAW_ALL = true; - static { setTransparency(100); --- 379,382 ---- *************** *** 495,499 **** tempSurfaces = new HashSet(); tempVertices = new HashSet(); - onTopEntities = new HashSet(); colorMap = new HashMap(); glObjects3D = new HashSet(); --- 489,492 ---- *************** *** 531,538 **** */ public void init(GLAutoDrawable gld) { if (log.isDebugEnabled()) { log.debug("[init]"); } ! gl = gld.getGL(); //ENABLE FOR DEBUG gld.setGL(new DebugGL(gld.getGL())); --- 524,532 ---- */ public void init(GLAutoDrawable gld) { + gl = gld.getGL(); if (log.isDebugEnabled()) { log.debug("[init]"); } ! //ENABLE FOR DEBUG gld.setGL(new DebugGL(gld.getGL())); *************** *** 612,623 **** */ public void display(GLAutoDrawable gld) { boolean hitdetection = false; ! gl.glClearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]); - gl = gld.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); ! ! glu = new GLU(); ! //gl.glViewport(0, 0, (int)width, (int)height); if (picking > 0) { selectBuffer = BufferUtil.newIntBuffer(selectionLength); --- 606,617 ---- */ public void display(GLAutoDrawable gld) { + gl = gld.getGL(); + glu = new GLU(); + boolean hitdetection = false; ! gl.glClearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); ! if (picking > 0) { selectBuffer = BufferUtil.newIntBuffer(selectionLength); *************** *** 627,631 **** } ! initCamera(gld); gl.glPushMatrix(); picking = 0; --- 621,625 ---- } ! initCamera(); gl.glPushMatrix(); picking = 0; *************** *** 636,640 **** gl.glLineWidth(1.0f); ! drawAll(gld, hitdetection); gl.glEnable(GL.GL_DEPTH_TEST); --- 630,634 ---- gl.glLineWidth(1.0f); ! drawAll(hitdetection); gl.glEnable(GL.GL_DEPTH_TEST); *************** *** 745,757 **** /** * The camera setup function - * @param gld The GLDrawable object */ ! public void initCamera(GLAutoDrawable gld) { if (log.isDebugEnabled()) { log.debug("[display]"); } - gl = gld.getGL(); - glu = new GLU(); - gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); --- 739,747 ---- /** * The camera setup function */ ! public void initCamera() { if (log.isDebugEnabled()) { log.debug("[display]"); } gl.glMatrixMode(GL.GL_PROJECTION); gl.glLoadIdentity(); *************** *** 837,848 **** /** * Draw all the existing elements - * @param gld The GLDrawable * @param hitdetection For hitdetection */ ! protected void drawAll(GLAutoDrawable gld, boolean hitdetection) { ! if (!hitdetection) { ! drawNormalMode(gld); } else { ! drawSelectionMode(gld); } } --- 827,837 ---- /** * Draw all the existing elements * @param hitdetection For hitdetection */ ! protected void drawAll(boolean hitdetection) { ! if (!hitdetection) { ! drawNormalMode(); } else { ! drawSelectionMode(); } } *************** *** 854,921 **** public Collection collectSupportingEdges(Space active) { Collection edges = new HashSet(); ! ! if (DRAW_ALL) { ! if (active != Project.getInstance().world()) { ! Space current = active; ! while (current != null) { ! if (current.isUnion()) { ! Collection<Surface> surfaces = new LinkedList<Surface>(); ! current.collectSurfaces(surfaces); ! edges.addAll(Surface.edges(surfaces)); ! } else { ! edges.addAll(current.getEdges()); ! } ! current = current.getOwner(); ! } ! } ! } else { ! if (active != Project.getInstance().world()) { ! Space empty = active.getOwner().getEmpty(); ! Collection envelope = active.getEnvelope(); ! Set spaces = new HashSet(); ! { ! Iterator iter = envelope.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! Space other; ! if (current.getFrontDomain() == active) { ! other = current.getBackDomain(); ! } else { ! other = current.getFrontDomain(); ! } ! if (other != empty) { ! spaces.add(other); ! } ! } ! } ! Set surfaces = new HashSet(); ! surfaces.addAll(envelope); ! { ! Iterator iter = spaces.iterator(); ! while (iter.hasNext()) { ! Space current = (Space) iter.next(); ! surfaces.addAll(current.getEnvelope()); ! } ! } ! { ! Set holes = new HashSet(); ! Iterator iter = surfaces.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! holes.addAll(current.getHoles()); ! } ! surfaces.addAll(holes); ! } ! edges.addAll(Surface.edges(surfaces)); ! } ! { ! Iterator iter = Selection.primary().iterator(); ! while (iter.hasNext()) { ! Geometric current = (Geometric) iter.next(); ! if (current instanceof Space) { ! Space space = (Space) current; ! edges.addAll(space.getEdges()); ! } } } } --- 843,857 ---- public Collection collectSupportingEdges(Space active) { Collection edges = new HashSet(); ! if (active != Project.getInstance().world()) { ! Space current = active; ! while (current != null) { ! if (current.isUnion()) { ! Collection<Surface> surfaces = new LinkedList<Surface>(); ! current.collectSurfaces(surfaces); ! edges.addAll(Surface.edges(surfaces)); ! } else { ! edges.addAll(current.getEdges()); } + current = current.getOwner(); } } *************** *** 925,931 **** /** * Draw the model normally - * @param gld The GLDrawable */ ! private void drawNormalMode(GLAutoDrawable gld) { Collection selection = Selection.primary(); gl.glEnable(GL.GL_DEPTH_TEST); --- 861,866 ---- /** * Draw the model normally */ ! private void drawNormalMode() { Collection selection = Selection.primary(); gl.glEnable(GL.GL_DEPTH_TEST); *************** *** 968,982 **** } ! if (DRAW_ALL) { ! drawSpace(Project.getInstance().world(), gld, true); ! } else { ! Space active = Project.getInstance().getActiveSpace(); ! drawSpace(active, gld, false); ! Object o; ! } //Draw edges if (doDrawEdges) { ! drawEdges(gld); } --- 903,913 ---- } ! drawSpace(Project.getInstance().world(), true); //Draw edges if (doDrawEdges) { ! disableClipplanes(); ! drawGeneralEdges(tempEdges, false); ! enableClipplanes(); } *************** *** 1025,1041 **** while (it.hasNext()) { GlObject glo = (GlObject) it.next(); ! glo.draw(gld); } } drawConstructorPlanes(); - - gl.glDisable(GL.GL_DEPTH_TEST); - { - Iterator it = onTopEntities.iterator(); - while (it.hasNext()) { - drawGeometric((Geometric) it.next()); - } - } } --- 956,964 ---- while (it.hasNext()) { GlObject glo = (GlObject) it.next(); ! glo.draw(gl); } } drawConstructorPlanes(); } *************** *** 1136,1144 **** /** * Draw space - * @param gld GLDrawable * @param space The Space * @param dodge dodge the colors */ ! private void drawSpace(Space space, GLAutoDrawable gld, boolean dodge) { if (space == Project.getInstance().getActiveSpace()) { dodge = false; --- 1059,1066 ---- /** * Draw space * @param space The Space * @param dodge dodge the colors */ ! private void drawSpace(Space space, boolean dodge) { if (space == Project.getInstance().getActiveSpace()) { dodge = false; *************** *** 1155,1162 **** gl.glCullFace(GL.GL_BACK); ! drawSurfaces(gld, surfaces, FRONT, dodge); gl.glCullFace(GL.GL_FRONT); ! drawSurfaces(gld, surfaces, BACK, dodge); gl.glDisable(GL.GL_CULL_FACE); --- 1077,1084 ---- gl.glCullFace(GL.GL_BACK); ! drawSurfaces(surfaces, FRONT, dodge); gl.glCullFace(GL.GL_FRONT); ! drawSurfaces(surfaces, BACK, dodge); gl.glDisable(GL.GL_CULL_FACE); *************** *** 1173,1177 **** gl.glPolygonOffset(1.0f, 1.0f); gl.glColor3fv(SURFACE_COLOR, 0); ! drawSurfaces(gld, surfaces, BOTH, dodge); gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); break; --- 1095,1099 ---- gl.glPolygonOffset(1.0f, 1.0f); gl.glColor3fv(SURFACE_COLOR, 0); ! drawSurfaces(surfaces, BOTH, dodge); gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); break; *************** *** 1179,1183 **** } if (doDrawEdges) { ! drawGeneralEdges(gld, space.getEdges(), dodge); } Collection elements = space.getElements(); --- 1101,1105 ---- } if (doDrawEdges) { ! drawGeneralEdges(space.getEdges(), dodge); } Collection elements = space.getElements(); *************** *** 1185,1189 **** while (iter.hasNext()) { Space current = (Space) iter.next(); ! drawSpace(current, gld, dodge); } gl.glPopMatrix(); --- 1107,1111 ---- while (iter.hasNext()) { Space current = (Space) iter.next(); ! drawSpace(current, dodge); } gl.glPopMatrix(); *************** *** 1251,1272 **** /** - * Draw all edges - * @param gld The GLDrawable - */ - private void drawEdges(GLAutoDrawable gld) { - disableClipplanes(); - drawGeneralEdges(gld, tempEdges, false); - enableClipplanes(); - - if (!DRAW_ALL) { - Space active = Project.getInstance().getActiveSpace(); - if (active != Project.getInstance().world()) { - Collection edges = collectSupportingEdges(active); - drawConstructionEdges(gld, edges); - } - } - } - - /** * Draw constructor planes. * --- 1173,1176 ---- *************** *** 1588,1596 **** /** * FIXME edge-drawing - * @param gld The GLDrawable * @param edges The edges * @param dodge dodge colors */ ! public void drawGeneralEdges(GLAutoDrawable gld, Collection edges, boolean dodge) { gl.glLineWidth(1.0f); gl.glColor3fv(lineColor, 0); --- 1492,1499 ---- /** * FIXME edge-drawing * @param edges The edges * @param dodge dodge colors */ ! public void drawGeneralEdges(Collection edges, boolean dodge) { gl.glLineWidth(1.0f); gl.glColor3fv(lineColor, 0); *************** *** 1651,1661 **** /** * Draw the surfaces - * @param gld The GLDrawable * @param surfaces The surfaces to draw * @param side The side of the Surface to draw * @param dodge dodge colors */ ! private void drawSurfaces(GLAutoDrawable gld, Collection surfaces, int side, boolean dodge) { ! GL gl = gld.getGL(); Iterator it = surfaces.iterator(); while (it.hasNext()) { --- 1554,1562 ---- /** * Draw the surfaces * @param surfaces The surfaces to draw * @param side The side of the Surface to draw * @param dodge dodge colors */ ! private void drawSurfaces(Collection surfaces, int side, boolean dodge) { Iterator it = surfaces.iterator(); while (it.hasNext()) { *************** *** 2023,2029 **** /** * Draws the objects for selection - * @param gld The GLDrawable */ ! private void drawSelectionMode(GLAutoDrawable gld) { Space space = Project.getInstance().getActiveSpace(); Collection surfaces = new LinkedList(); --- 1924,1929 ---- /** * Draws the objects for selection */ ! private void drawSelectionMode() { Space space = Project.getInstance().getActiveSpace(); Collection surfaces = new LinkedList(); *************** *** 2058,2063 **** selectionMode = OBJECTS; } ! ! gl = gld.getGL(); initNames(gl); --- 1958,1962 ---- selectionMode = OBJECTS; } ! initNames(gl); *************** *** 2141,2145 **** GlObject glo = (GlObject) it.next(); pushName(gl, glo); ! glo.draw(gld); popName(gl); } --- 2040,2044 ---- GlObject glo = (GlObject) it.next(); pushName(gl, glo); ! glo.draw(gl); popName(gl); } *************** *** 3105,3116 **** /** - * Adds a temporary edge to be drawn on top. - * @param e the edge - */ - public void addTempEdgeOnTop(Edge e) { - onTopEntities.add(e); - } - - /** * Removes a temporary edge * @param e the edge to remove --- 3004,3007 ---- *************** *** 3129,3140 **** /** - * Adds a temporary vertex to be drawn on top. - * @param v the vertex - */ - public void addTempVertexOnTop(Vertex v) { - onTopEntities.add(v); - } - - /** * Removes a temporary vertex * @param v the vertex to remove --- 3020,3023 ---- *************** *** 3144,3155 **** } - /** - * Removes a temporary Entity that is on top - * @param e the entity to remove - */ - public void removeEntityOnTop(Entity e) { - onTopEntities.remove(e); - } - /** * Puts a new color in the color map for an entity --- 3027,3030 ---- |
|
From: Michael L. <he...@us...> - 2007-02-14 14:27:32
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17746/src/net/sourceforge/bprocessor/gl/model Modified Files: GlObject.java Log Message: Refactoring draw code Ð removed usage of gld Index: GlObject.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model/GlObject.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GlObject.java 2 Jan 2007 17:45:40 -0000 1.3 --- GlObject.java 14 Feb 2007 14:27:24 -0000 1.4 *************** *** 8,12 **** ! import javax.media.opengl.GLAutoDrawable; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; --- 8,12 ---- ! import javax.media.opengl.GL; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; *************** *** 21,27 **** /** * Draw the globject via the GL draw methods ! * @param gld the GLDrawable */ ! public void draw(GLAutoDrawable gld); /** --- 21,27 ---- /** * Draw the globject via the GL draw methods ! * @param gl the GL interface */ ! public void draw(GL gl); /** |
|
From: Michael L. <he...@us...> - 2007-02-14 14:27:32
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17746/src/net/sourceforge/bprocessor/gl/tool Modified Files: RotationTool.java Log Message: Refactoring draw code Ð removed usage of gld Index: RotationTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RotationTool.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** RotationTool.java 2 Jan 2007 18:29:50 -0000 1.25 --- RotationTool.java 14 Feb 2007 14:27:24 -0000 1.26 *************** *** 33,37 **** import javax.media.opengl.GL; - import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.glu.GLU; --- 33,36 ---- *************** *** 341,345 **** * @inheritDoc */ ! public void draw(GLAutoDrawable gld) { double angle = Math.toDegrees(totalAngle); Camera cam = Project.getInstance().getCurrentCamera(); --- 340,344 ---- * @inheritDoc */ ! public void draw(GL gl) { double angle = Math.toDegrees(totalAngle); Camera cam = Project.getInstance().getCurrentCamera(); *************** *** 347,351 **** double dist = camorig.distance(plane.origin()); factor = dist / 20; - GL gl = gld.getGL(); GLU glu = new GLU(); // translate --- 346,349 ---- |
|
From: rimestad <rim...@us...> - 2007-02-14 13:50:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3582/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrusionTool.java Log Message: small fixes to make the tool give better responce Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** ExtrusionTool.java 13 Feb 2007 15:05:47 -0000 1.45 --- ExtrusionTool.java 14 Feb 2007 13:50:21 -0000 1.46 *************** *** 162,165 **** --- 162,166 ---- protected void moved(MouseEvent e) { if (extrudesurface == null) { + //the extrusion isn't started yet findTarget(e); if (target instanceof Surface) { *************** *** 168,176 **** glv.getView().makeTarget(null); } - } else { active = true; to = glv.getView().toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); Vertex normal = extrudesurface.normal(); ! Set elements = new HashSet(); if (extrusion != null) { --- 169,180 ---- glv.getView().makeTarget(null); } active = true; + } else { + // a extrudesurface have been chosen to = glv.getView().toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); Vertex normal = extrudesurface.normal(); ! //a bit cleanup ! ontoPlane = null; ! // the list of all extruded geometric objects Set elements = new HashSet(); if (extrusion != null) { *************** *** 185,192 **** Surface sur = (Surface) target; if (normal.dot(sur.normal()) == 0) { ! // the normals are orthogonal ! Vertex delta = to.minus(from); ! distance = normal.dot(delta); ! extrude(distance, all, false); } else { ontoPlane = sur.plane(); --- 189,195 ---- Surface sur = (Surface) target; if (normal.dot(sur.normal()) == 0) { ! /* the normals are orthogonal so we cant extrude one to the other ! therefore we just extrude as useual */ ! calcDistCallExtrude(to, from, normal); } else { ontoPlane = sur.plane(); *************** *** 194,200 **** } } else { ! Vertex delta = to.minus(from); ! distance = normal.dot(delta); ! extrude(distance, all, false); } } else { --- 197,201 ---- } } else { ! calcDistCallExtrude(to, from, normal); } } else { *************** *** 222,228 **** } } ! Vertex delta = to.minus(from); ! distance = normal.dot(delta); ! extrude(distance, all, false); } } --- 223,227 ---- } } ! calcDistCallExtrude(to, from, normal); } } *************** *** 231,234 **** --- 230,244 ---- /** + * @param to + * @param from + * @param normal + */ + private void calcDistCallExtrude(Vertex to, Vertex from, Vertex normal) { + Vertex delta = to.minus(from); + distance = normal.dot(delta); + extrude(distance, all, false); + } + + /** * Pressed * @param e MouseEvent *************** *** 257,261 **** if (extrusion != null) { if (metaPressed) { ! extrudeOnto(ontoPlane, all, true); } else { extrude(distance, all, true); --- 267,275 ---- if (extrusion != null) { if (metaPressed) { ! if (ontoPlane != null) { ! extrudeOnto(ontoPlane, all, true); ! } else { ! extrude(distance, all, true); ! } } else { extrude(distance, all, true); |
|
From: rimestad <rim...@us...> - 2007-02-14 11:42:02
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10164/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Encapsulated one of the common trhown errors in a try catch to get a log.error but not a exception running wild Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.182 retrieving revision 1.183 diff -C2 -d -r1.182 -r1.183 *** View.java 12 Feb 2007 13:44:12 -0000 1.182 --- View.java 14 Feb 2007 11:41:57 -0000 1.183 *************** *** 1755,1759 **** */ private void drawContour(Surface surface, GLUtessellator tess) { ! List vertices = surface.getVertices(); if (vertices.size() > 0) { Vertex first = (Vertex) vertices.get(0); --- 1755,1765 ---- */ private void drawContour(Surface surface, GLUtessellator tess) { ! List vertices = null; ! try { ! vertices = surface.getVertices(); ! } catch (Error e) { ! log.error("Didn't draw surface " + surface + " due to exception " + e); ! return; ! } if (vertices.size() > 0) { Vertex first = (Vertex) vertices.get(0); |
|
From: rimestad <rim...@us...> - 2007-02-13 15:40:33
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv654/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java ExtrusionTool.java Log Message: added new extrude Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** ExtrusionTool.java 7 Dec 2006 00:24:53 -0000 1.44 --- ExtrusionTool.java 13 Feb 2007 15:05:47 -0000 1.45 *************** *** 15,18 **** --- 15,20 ---- import java.util.Set; + import org.apache.log4j.Logger; + import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.Transformation; *************** *** 29,32 **** --- 31,36 ---- */ public class ExtrusionTool extends AbstractPencil { + /** The logger */ + private static Logger log = Logger.getLogger(ExtrusionTool.class); /** Surface to extrude */ *************** *** 56,59 **** --- 60,65 ---- /** Extrusion */ private Collection extrusion; + + private Plane ontoPlane; /** *************** *** 114,117 **** --- 120,160 ---- /** + * Extrude + * @param p the plane to extrude onto + * @param all Extrude all + * @param finish Finish extrusion + */ + public void extrudeOnto(Plane p, boolean all, boolean finish) { + Space space = Project.getInstance().getActiveSpace(); + if (extrusion != null) { + space.removeProtected(extrusion); + space.computeNextId(); + extrusion = null; + } + extrusion = new LinkedList(); + Collection sides = new LinkedList(); + Set tops = new HashSet(); + if (p == null) { + log.info("Found null plane"); + return; + } + if (all) { + extrudesurface.extrusionAllOnto(p, sides, tops); + extrusion.addAll(sides); + extrusion.addAll(tops); + } else { + Surface top = extrudesurface.extrusionOnto(p, sides); + extrusion.add(top); + extrusion.addAll(sides); + } + if (finish) { + insert(space, extrusion); + + } else { + space.addProtected(extrusion); + } + } + + /** * Moved * @param e MouseEvent *************** *** 136,161 **** elements.add(extrudesurface); } ! findTarget(e, elements); ! if (target instanceof Surface) { ! Surface surface = (Surface) target; ! Vertex n = surface.normal(); ! Vertex cross = normal.cross(n); ! if (cross.isZero()) { ! Vertex v = surface.getFirstVertex(); ! if (!extrudesurface.plane().contains(v)) { ! to = v; } } ! } else if (target instanceof Edge) { ! Edge edge = (Edge) target; ! to = edge.center(); ! Vertex v = edge.center(); ! if (!extrudesurface.plane().contains(v)) { ! to = v; } } - Vertex delta = to.minus(from); - distance = normal.dot(delta); - extrude(distance, all, false); } updateLength(); --- 179,229 ---- elements.add(extrudesurface); } ! findTarget(e); ! if (metaPressed) { ! // extrude onto the plane generated by surfaces ! if (target instanceof Surface && extrusion != null && !extrusion.contains(target)) { ! Surface sur = (Surface) target; ! if (normal.dot(sur.normal()) == 0) { ! // the normals are orthogonal ! Vertex delta = to.minus(from); ! distance = normal.dot(delta); ! extrude(distance, all, false); ! } else { ! ontoPlane = sur.plane(); ! extrudeOnto(ontoPlane, all, false); } + } else { + Vertex delta = to.minus(from); + distance = normal.dot(delta); + extrude(distance, all, false); } ! } else { ! // extrude the normal way ! if (target instanceof Surface) { ! Surface surface = (Surface) target; ! if (!elements.contains(surface)) { ! Vertex n = surface.normal(); ! Vertex cross = normal.cross(n); ! if (cross.isZero()) { ! Vertex v = surface.getFirstVertex(); ! if (!extrudesurface.plane().contains(v)) { ! to = v; ! } ! } ! } ! } else if (target instanceof Edge) { ! Edge edge = (Edge) target; ! if (!elements.contains(edge)) { ! to = edge.center(); ! Vertex v = edge.center(); ! if (!extrudesurface.plane().contains(v)) { ! to = v; ! } ! } } + Vertex delta = to.minus(from); + distance = normal.dot(delta); + extrude(distance, all, false); } } updateLength(); *************** *** 188,192 **** } else { if (extrusion != null) { ! extrude(distance, all, true); extrusion = null; Project.getInstance().checkpoint(); --- 256,264 ---- } else { if (extrusion != null) { ! if (metaPressed) { ! extrudeOnto(ontoPlane, all, true); ! } else { ! extrude(distance, all, true); ! } extrusion = null; Project.getInstance().checkpoint(); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** AbstractTool.java 8 Feb 2007 12:23:13 -0000 1.112 --- AbstractTool.java 13 Feb 2007 15:05:47 -0000 1.113 *************** *** 236,240 **** up.scale(2 / up.length()); if (e.getKeyCode() == KeyEvent.VK_META || e.getKeyCode() == KeyEvent.VK_ALT) { - log.info("META:" + e); metaPressed = true; glv.setCursor(metaCursor); --- 236,239 ---- |
|
From: rimestad <rim...@us...> - 2007-02-13 15:40:31
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv626/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: extrusion onto planes Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** Surface.java 31 Jan 2007 20:56:40 -0000 1.135 --- Surface.java 13 Feb 2007 15:05:14 -0000 1.136 *************** *** 1844,1846 **** --- 1844,1974 ---- return closest; } + + /** + * @param p The plane to extrude onto + * @param sides The the collection of already extruded sides (if none the resulting is added) + * @param tops The top surfaces + * @return the new created extrusion top surface + */ + public Surface extrusionAllOnto(Plane p, Collection sides, Set tops) { + Surface top = extrusionOnto(p, sides); + tops.add(top); + Iterator iter = getHoles().iterator(); + while (iter.hasNext()) { + Surface hole = (Surface) iter.next(); + Surface holetop = hole.extrusionAllOnto(p, sides, tops); + top.addHole(holetop); + } + return top; + } + + /** + * @param p the plane to extrude onto + * @param sides the collection of all resulting side surfaces + * @return the new extrusion top surface + */ + public Surface extrusionOnto(Plane p, Collection 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 { + log.info("The found intersection were null"); + vmap[i] = v[i].copy().add(normal); + } + } + + 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(); + } + + int delta = 1; + 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; + } } |
|
From: Michael L. <he...@us...> - 2007-02-12 14:40:01
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2418/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Fixed distance-calculation for drawing hilited constructors Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.181 retrieving revision 1.182 diff -C2 -d -r1.181 -r1.182 *** View.java 7 Feb 2007 10:00:02 -0000 1.181 --- View.java 12 Feb 2007 13:44:12 -0000 1.182 *************** *** 1241,1245 **** Camera camera = Project.getInstance().getCurrentCamera(); Vertex v = new Vertex(camera.getCamera()); ! double scale = (camera.getFocalwidth() / 65) * (500 / height); double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; if (camera.getType() == Camera.PERSPECTIVE) { --- 1241,1245 ---- Camera camera = Project.getInstance().getCurrentCamera(); Vertex v = new Vertex(camera.getCamera()); ! double scale = (camera.getFocalwidth() / 65); double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; if (camera.getType() == Camera.PERSPECTIVE) { |
|
From: rimestad <rim...@us...> - 2007-02-08 12:24:34
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19391/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: added connected geometry to a constructor in the tree... Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** GenericTreeView.java 31 Jan 2007 21:01:42 -0000 1.71 --- GenericTreeView.java 8 Feb 2007 12:24:32 -0000 1.72 *************** *** 712,716 **** * ConstructorNode */ ! public class ConstructorNode extends EntityNode { /** * --- 712,716 ---- * ConstructorNode */ ! public class ConstructorNode extends ContainerNode { /** * *************** *** 723,727 **** */ public ConstructorNode(Constructor c) { ! super(c); } --- 723,727 ---- */ public ConstructorNode(Constructor c) { ! super(c, c.getConnectedGeometry()); } *************** *** 733,736 **** --- 733,749 ---- return constructoricon; } + + /** + * {@inheritDoc} + */ + public void update(Object o) { + if (o instanceof Constructor) { + if (updated == o) { + model.nodeChanged(this); + } + Constructor c = (Constructor) o; + super.update(c.getConnectedGeometry()); + } + } } |
|
From: rimestad <rim...@us...> - 2007-02-08 12:23:49
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19014/src/net/sourceforge/bprocessor/model Modified Files: Constructor.java Log Message: added method to remove one contected geometry object Index: Constructor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Constructor.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Constructor.java 6 Feb 2007 17:27:18 -0000 1.16 --- Constructor.java 8 Feb 2007 12:23:39 -0000 1.17 *************** *** 160,164 **** } ! /** --- 160,170 ---- } ! /** ! * disconnects a pieces of geometry to this constructor ! * @param g a geometric ! */ ! public void disconnect(Geometric g) { ! connectedGeometry.remove(g); ! } /** |
|
From: rimestad <rim...@us...> - 2007-02-08 12:23:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18991/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java RelationTool.java ToolFactory.java Log Message: added new icons and made relation tool use them... modified VK_META to be both that and VK_ALT because that only works on windows... Index: RelationTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RelationTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RelationTool.java 6 Feb 2007 17:30:17 -0000 1.1 --- RelationTool.java 8 Feb 2007 12:23:13 -0000 1.2 *************** *** 8,12 **** --- 8,16 ---- import java.awt.Cursor; + import java.awt.Image; + import java.awt.Point; + import java.awt.Toolkit; import java.awt.event.MouseEvent; + import java.net.URL; import java.util.ArrayList; import java.util.List; *************** *** 17,20 **** --- 21,25 ---- import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Project; /** *************** *** 33,36 **** --- 38,47 ---- public RelationTool(GLView glv, Cursor cursor) { super(glv, cursor); + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("Bcursorremove.gif"); + Image arrowMinusCursor = Toolkit.getDefaultToolkit().getImage(url); + metaCursor = + Toolkit.getDefaultToolkit().createCustomCursor(arrowMinusCursor, + new Point(0, 0), "Remove connection"); } *************** *** 71,75 **** */ protected void pressed(MouseEvent e) { ! onVertex(); moved(e); } --- 82,86 ---- */ protected void pressed(MouseEvent e) { ! onVertex(e); moved(e); } *************** *** 87,92 **** /** * Current vertex is pressed */ ! public void onVertex() { if (constructor == null) { if (target != null) { --- 98,104 ---- /** * Current vertex is pressed + * @param e The event that resulted in this call */ ! public void onVertex(MouseEvent e) { if (constructor == null) { if (target != null) { *************** *** 105,109 **** if (target instanceof Geometric) { Geometric g = (Geometric) target; ! constructor.connect(g); cleanUp(); } else { --- 117,129 ---- if (target instanceof Geometric) { Geometric g = (Geometric) target; ! if (metaPressed) { ! // remove the connection ! constructor.disconnect(g); ! } else { ! // add a connection ! constructor.connect(g); ! } ! Project.getInstance().changed(constructor); ! Project.getInstance().checkpoint(); cleanUp(); } else { Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** ToolFactory.java 6 Feb 2007 17:30:17 -0000 1.74 --- ToolFactory.java 8 Feb 2007 12:23:13 -0000 1.75 *************** *** 184,187 **** --- 184,191 ---- Cursor walkCursor = Toolkit.getDefaultToolkit().createCustomCursor(walkImage, new Point(7, 8), "Walk"); + url = cl.getResource("Bcursoradd.gif"); + Image arrowAddImage = Toolkit.getDefaultToolkit().getImage(url); + Cursor arrowAddCursor = + Toolkit.getDefaultToolkit().createCustomCursor(arrowAddImage, new Point(0, 0), "Add"); select = new SpaceTool(glv, null); *************** *** 196,200 **** clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasure(glv, pencilcursor); ! relation = new RelationTool(glv, pencilcursor); camera = new CameraTool(glv, rotationCursor); fly = new CameraFlyTool(glv, flyCursor); --- 200,204 ---- clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasure(glv, pencilcursor); ! relation = new RelationTool(glv, arrowAddCursor); camera = new CameraTool(glv, rotationCursor); fly = new CameraFlyTool(glv, flyCursor); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** AbstractTool.java 6 Feb 2007 17:28:26 -0000 1.111 --- AbstractTool.java 8 Feb 2007 12:23:13 -0000 1.112 *************** *** 122,125 **** --- 122,131 ---- private Cursor orbitCursor; + /** true if meta is pressed otherwise false */ + protected boolean metaPressed = false; + + /** The cursor for alternative tool (that is when meta is pressed) */ + protected Cursor metaCursor = null; + /** * KeyListener for the GL Canvas *************** *** 229,234 **** sidewards.scale(2 / sidewards.length()); up.scale(2 / up.length()); ! if (e.getKeyCode() == KeyEvent.VK_META) { ! glv.setCursor(null); return; } --- 235,242 ---- sidewards.scale(2 / sidewards.length()); up.scale(2 / up.length()); ! if (e.getKeyCode() == KeyEvent.VK_META || e.getKeyCode() == KeyEvent.VK_ALT) { ! log.info("META:" + e); ! metaPressed = true; ! glv.setCursor(metaCursor); return; } *************** *** 272,276 **** */ public void keyReleased(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_META) { glv.setCursor(cursor); } --- 280,285 ---- */ public void keyReleased(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_META || e.getKeyCode() == KeyEvent.VK_ALT) { ! metaPressed = false; glv.setCursor(cursor); } |
|
From: rimestad <rim...@us...> - 2007-02-08 12:23:20
|
Update of /cvsroot/bprocessor/gl/src/gfx In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18991/src/gfx Added Files: Bcursoradd.gif Bcursorremove.gif Log Message: added new icons and made relation tool use them... modified VK_META to be both that and VK_ALT because that only works on windows... --- NEW FILE: Bcursorremove.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Bcursoradd.gif --- (This appears to be a binary file; contents omitted.) |