bprocessor-commit Mailing List for B-processor (Page 33)
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-12-12 10:48:22
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1801/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java GUI.java Log Message: Removed a lot of copying code Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** PopupMenu.java 11 Dec 2007 15:14:19 -0000 1.86 --- PopupMenu.java 12 Dec 2007 10:48:19 -0000 1.87 *************** *** 246,264 **** menu.add(action); } - AbstractAction copy = new CollectionMenuAction(s, "Duplicate") { - public void actionPerformed(ActionEvent arg0) { - if (col != null) { - Iterator iter = col.iterator(); - while (iter.hasNext()) { - Space space = (Space)iter.next(); - Space spaceCopy = space.copy(); - space.getOwner().add(spaceCopy); - Selection.primary().set(spaceCopy); - Project.getInstance().checkpoint(); - } - } - } - }; - menu.add(copy); AbstractAction instantiate = new CollectionMenuAction(s, "Instantiate") { public void actionPerformed(ActionEvent arg0) { --- 246,249 ---- Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** GUI.java 12 Dec 2007 10:41:11 -0000 1.86 --- GUI.java 12 Dec 2007 10:48:19 -0000 1.87 *************** *** 405,411 **** Geometric g = iter.next(); if (g instanceof Space) { ! Space copy = ((Space)g).copy(); ! g.getOwner().add(copy); ! copied.add(copy); } else if (g instanceof Edge) { Edge copy = ((Edge)g).copy(); --- 405,409 ---- Geometric g = iter.next(); if (g instanceof Space) { ! // nothing } else if (g instanceof Edge) { Edge copy = ((Edge)g).copy(); |
From: Michael L. <he...@us...> - 2007-12-12 10:48:11
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1791/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: Removed a lot of copying code Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.216 retrieving revision 1.217 diff -C2 -d -r1.216 -r1.217 *** Space.java 12 Dec 2007 10:41:07 -0000 1.216 --- Space.java 12 Dec 2007 10:48:11 -0000 1.217 *************** *** 1483,1500 **** /** - * Copy this space and return the copy - * @return the copy of this space - */ - public Space copy() { - Map<Vertex, Vertex> copiedVertices = new HashMap<Vertex, Vertex>(); - Map<Edge, Edge> copiedEdges = new HashMap<Edge, Edge>(); - Map<Surface, Surface> copiedSurfaces = new HashMap<Surface, Surface>(); - Map<Space, Space> copiedSpaces = new HashMap<Space, Space>(); - Space copy = this.copy(copiedVertices, copiedEdges, - copiedSurfaces, copiedSpaces); - return copy; - } - - /** * * @return new space --- 1483,1486 ---- *************** *** 1514,1758 **** /** - * Copy the envelope of the owner - * - */ - public void copyOwnerEnvelope() { - Collection envelope = getEnvelope(); - Iterator iter = envelope.iterator(); - while (iter.hasNext()) { - Surface current = (Surface) iter.next(); - current.copyall(this); - } - } - - /** - * Copy this space and return the copy - * @param copiedVertices map of vertices and their copies. - * @param copiedEdges map of edges and their copies. - * @param copiedSurfaces map of surfaces and their copies. - * @param copiedSpaces map of spaces and their copies. - * @return the copy of this space - */ - private Space copy(Map<Vertex, Vertex> copiedVertices, - Map<Edge, Edge> copiedEdges, - Map<Surface, Surface> copiedSurfaces, - Map<Space, Space> copiedSpaces) { - Space copy = new Space("", - this.getType(), - this.isContainer()); - copy.setName(this.getName()); - copy.setUnion(this.isUnion()); - copy.setTransparent(transparent); - Set<Surface> envelopeCopy = copyEnvelope(copiedVertices, - copiedEdges, - copiedSurfaces, - copy); - copy.setEnvelope(envelopeCopy); - if (copy.isContainer()) { - copyInteriorGeometry(copiedVertices, - copiedEdges, - copiedSurfaces, - copy); - copyInteriorSpaces(copiedVertices, - copiedEdges, - copiedSurfaces, - copiedSpaces, - copy); - } - return copy; - } - - /** - * Copies the interior spaces of this space. - * The method maintains the four copy maps of vertices, edges, - * surfaces and spaces. - * @param copiedVertices map of vertices and their copies. - * @param copiedEdges map of edges and their copies. - * @param copiedSurfaces map of surfaces and their copies. - * @param copiedSpaces map of spaces and their copies. - * @param copy the copy of this space - */ - private void copyInteriorSpaces(Map<Vertex, Vertex> copiedVertices, - Map<Edge, Edge> copiedEdges, - Map<Surface, Surface> copiedSurfaces, - Map<Space, Space> copiedSpaces, - Space copy) { - Iterator it = elements.values().iterator(); - while (it.hasNext()) { - Space sp = (Space)it.next(); - if (sp != sp.getOwner().getEmpty()) { - Space newSpace = sp.copy(copiedVertices, - copiedEdges, - copiedSurfaces, - copiedSpaces); - copiedSpaces.put(sp, newSpace); - copy.add(newSpace); - copy.setName(copy.getName()); - } - } - } - - /** - * Copies the interior surfaces edges and vertices of this space. - * The method maintains the three copy maps of vertices, edges and - * surfaces. - * @param copiedVertices map of vertices and their copies. - * @param copiedEdges map of edges and their copies. - * @param copiedSurfaces map of surfaces and their copies. - * @param copy the copy of this space - */ - private void copyInteriorGeometry(Map<Vertex, Vertex> copiedVertices, - Map<Edge, Edge> copiedEdges, - Map<Surface, Surface> copiedSurfaces, - Space copy) { - Iterator it = vertices.values().iterator(); - while (it.hasNext()) { - Vertex v = (Vertex)it.next(); - Vertex vCopy = v.copy(); - copiedVertices.put(v, vCopy); - copy.add(vCopy); - } - it = edges.values().iterator(); - while (it.hasNext()) { - Edge e = (Edge)it.next(); - Edge eCopy = new Edge(copiedVertices.get(e.getTo()), - copiedVertices.get(e.getFrom())); - copiedEdges.put(e, eCopy); - copy.add(eCopy); - } - it = surfaces.values().iterator(); - while (it.hasNext()) { - Surface s = (Surface)it.next(); - copyInnerSurface(s, - copiedEdges, - copiedSurfaces, - copy); - } - } - - /** - * Copies a surface in the inner layers of the copy - * @param s the surface to copy - * @param copiedEdges map of edges and their copies. - * @param copiedSurfaces map of surfaces and their copies. - * @param copy the copy of this space - */ - private void copyInnerSurface(Surface s, - Map<Edge, Edge> copiedEdges, - Map<Surface, Surface> copiedSurfaces, - Space copy) { - if (!copiedSurfaces.keySet().contains(s)) { - List<Edge> newEdges = new LinkedList<Edge>(); - Iterator edgeIt = s.getEdges().iterator(); - while (edgeIt.hasNext()) { - newEdges.add(copiedEdges.get((Edge)edgeIt.next())); - } - Surface newSurface = new Surface(newEdges); - if (s.getExterior() != null) { - Surface exteriorCopy; - if (!copiedSurfaces.keySet().contains(s.getExterior())) { - copyInnerSurface(s.getExterior(), - copiedEdges, - copiedSurfaces, - copy); - } - exteriorCopy = copiedSurfaces.get(s.getExterior()); - exteriorCopy.addHole(newSurface); - } - newSurface.setFrontDomain(copy.getEmpty()); - newSurface.setBackDomain(copy.getEmpty()); - copiedSurfaces.put(s, newSurface); - copy.add(newSurface); - } - } - - /** - * Copies the envelope of this space and returns the - * set of surfaces that is the envelope. The method maintains the - * three copy maps of vertices, edges and surfaces. - * @param copiedVertices map of vertices and their copies. - * @param copiedEdges map of edges and their copies. - * @param copiedSurfaces map of surfaces and their copies. - * @param copy the copy of this space. - * @return the envelope set of surfaces - */ - private Set<Surface> copyEnvelope(Map<Vertex, Vertex> copiedVertices, - Map<Edge, Edge> copiedEdges, - Map<Surface, Surface> copiedSurfaces, - Space copy) { - Iterator it = this.envelope.iterator(); - Set<Surface> envelopeCopy = new HashSet<Surface>(); - while (it.hasNext()) { - Surface s = (Surface)it.next(); - Surface surfaceCopy; - if (copiedSurfaces.keySet().contains(s)) { - surfaceCopy = copiedSurfaces.get(s); - } else { - /* This should only apply to the outer layer */ - surfaceCopy = copyOuterSurface(s, copiedVertices, - copiedEdges, - copiedSurfaces); - - } - envelopeCopy.add(surfaceCopy); - if (s.getFrontDomain() == this) { - surfaceCopy.setFrontDomain(copy); - } - if (s.getBackDomain() == this) { - surfaceCopy.setBackDomain(copy); - } - } - return envelopeCopy; - } - - /** - * Copies a surface in the outer layer of the copy - * @param s the surface to copy - * @param copiedVertices map of vertices and their copies. - * @param copiedEdges map of edges and their copies. - * @param copiedSurfaces map of surfaces and their copies. - * @return the copy of the surface - */ - private Surface copyOuterSurface(Surface s, - Map<Vertex, Vertex> copiedVertices, - Map<Edge, Edge> copiedEdges, - Map<Surface, Surface> copiedSurfaces) { - Surface surfaceCopy; - { - Iterator edgeIt = s.getEdges().iterator(); - List<Edge> edgeCopies = new LinkedList<Edge>(); - while (edgeIt.hasNext()) { - Edge e = (Edge)edgeIt.next(); - if (!copiedVertices.keySet().contains(e.getTo())) { - copiedVertices.put(e.getTo(), e.getTo().copy()); - this.getOwner().add(copiedVertices.get(e.getTo())); - } - if (!copiedVertices.keySet().contains(e.getFrom())) { - copiedVertices.put(e.getFrom(), e.getFrom().copy()); - this.getOwner().add(copiedVertices.get(e.getFrom())); - } - if (!copiedEdges.keySet().contains(e)) { - copiedEdges.put(e, new Edge(copiedVertices.get(e.getFrom()), - copiedVertices.get(e.getTo()))); - } - this.getOwner().add(copiedEdges.get(e)); - edgeCopies.add(copiedEdges.get(e)); - } - surfaceCopy = new Surface(edgeCopies); - this.getOwner().add(surfaceCopy); - surfaceCopy.setFrontDomain(this.getOwner().getEmpty()); - surfaceCopy.setBackDomain(this.getOwner().getEmpty()); - - copiedSurfaces.put(s, surfaceCopy); - } - Iterator it = s.getHoles().iterator(); - while (it.hasNext()) { - Surface hole = (Surface)it.next(); - surfaceCopy.addHole(copyOuterSurface(hole, copiedVertices, copiedEdges, copiedSurfaces)); - } - return surfaceCopy; - } - - /** * @return Returns true if its transparent */ --- 1500,1503 ---- |
From: Michael L. <he...@us...> - 2007-12-12 10:41:09
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31475/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: Cut spacechecking code Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.215 retrieving revision 1.216 diff -C2 -d -r1.215 -r1.216 *** Space.java 11 Dec 2007 14:49:02 -0000 1.215 --- Space.java 12 Dec 2007 10:41:07 -0000 1.216 *************** *** 1840,2067 **** } - /** - * Finds out if this space is closed or not. - * @return true or false. - */ - public boolean isClosed() { - Iterator surfaces = envelope.iterator(); - Surface startSurface = null; - Set<Surface> coloured = new HashSet<Surface>(); - boolean done = false; - while (surfaces.hasNext() && !done) { - startSurface = (Surface)surfaces.next(); - if (!coloured.contains(startSurface)) { - if (colour(startSurface, coloured)) { - done = coloured.containsAll(envelope); - } else { - return false; - } - } - } - return true; - } - - /** - * Colours a surface and then calls it self recursively to colour its neighbours. - * returns true if the colouring is succesfull, false otherwise - * @param surface the surface to colour - * @param coloured the set of coloured surfaces. - * @return the outcome of the colouring - */ - private boolean colour(Surface surface, Set<Surface> coloured) { - coloured.add(surface); - boolean closed = true; - Iterator it = surface.getEdges().iterator(); - while (closed && it.hasNext()) { - Edge e = (Edge)it.next(); - Surface neighbour = neighbourOnEdge(surface, e); - if (neighbour != null) { - if (!coloured.contains(neighbour)) { - closed = colour(neighbour, coloured); - } - } else { - closed = false; - } - } - return closed; - } - - /** - * Determines if a surface can be coloured. - * @param s a surface - * @param angle the angle of the surface with the previous surface - * @param i - - * @param j - - * @return wherter or not it can be coloured. - */ - private boolean colourable(Surface s, double angle, Vertex i, Vertex j) { - boolean colourable = false; - if (s != null) { - Vertex spaceVector = s.normal(); - if (s.getFrontDomain() == this) { - spaceVector.scaleIt(1 / spaceVector.length()); - } else if (s.getBackDomain() == this) { - spaceVector.scaleIt(-1 / spaceVector.length()); - } else { - return false; - } - if (angle > Math.PI && spaceVector.dot(i) > 0) { - colourable = true; - } - if (angle < Math.PI && spaceVector.dot(i) < 0) { - colourable = true; - } - if (Math.abs(angle - Math.PI) < 0.00001 && spaceVector.dot(j) > 0) { - colourable = true; - } - if (Math.abs(angle) < 0.00001 && spaceVector.dot(j) < 0) { - colourable = true; - } - } - return colourable; - } - - /** - * Finds the next colourable surface on an edge - * @param startSurface the surface to find neighbours for. - * @param sharedEdge the shared edge - * @return the neighbour surface. - */ - private Surface neighbourOnEdge(Surface startSurface, Edge sharedEdge) { - //Building a coordinate system: - Vertex n = sharedEdge.getDirection(); - n.scaleIt(1 / n.length()); - - Vertex j = startSurface.normal(); - if (j == null) { - return null; - } - if (startSurface.getFrontDomain() == this) { - j.scaleIt(1 / j.length()); - } else { - j.scaleIt(-1 / j.length()); - } - - LinkedList<Edge> edges = new LinkedList<Edge>(startSurface.getEdges()); - Vertex sharedVertex = sharedEdge.getFrom(); - Vertex adjacentVertex = findNextVertex(sharedEdge, sharedVertex, edges); - - - Plane p = new Plane(n.getX(), n.getY(), n.getZ(), - -(n.getX() * sharedVertex.getX() + - n.getY() * sharedVertex.getY() + - n.getZ() * sharedVertex.getZ())); - Vertex i = (p.project(sharedVertex)).minus(p.project(adjacentVertex)); - i.scaleIt(1 / i.length()); - CoordinateSystem cs = new CoordinateSystem(i, j , n, sharedVertex); - - //Finding the surface with the minimal angle to the startSurface: - Iterator it = sharedEdge.getSurfaces().iterator(); - Surface neighbour = null; - double minAngle = (Math.PI * 2 + 1); - double angle = minAngle; - while (it.hasNext()) { - Surface s = (Surface)it.next(); - if (s != startSurface) { - LinkedList<Edge> l = new LinkedList<Edge>(s.getEdges()); - Vertex notShared = findNextVertex(sharedEdge, sharedVertex, l); - if (notShared != null) { - angle = findAngle(sharedVertex, notShared, cs); - if (angle < minAngle && colourable(s, angle, i, j)) { - minAngle = angle; - neighbour = s; - } - if (s.getExterior() != null) { - angle = (angle + Math.PI) % (2 * Math.PI); - if (angle < minAngle && colourable(s.getExterior(), - angle, i, j)) { - minAngle = angle; - neighbour = s.getExterior(); - } - } - } - } - } - return neighbour; - } - - /** - * finds the angle between the x-axis of the coordinate system and - * a neighbour-surface to the sharedEdge. - * @param shared - - * @param notShared - - * @param coordinateSystem - - * @return the angle. - */ - private double findAngle(Vertex shared, Vertex notShared, - CoordinateSystem coordinateSystem) { - Vertex projShared = coordinateSystem.projection(shared); - Vertex projNotShared = coordinateSystem.projection(notShared); - Vertex projEdgeDir = projNotShared.minus(projShared); - projEdgeDir.scaleIt(1 / projEdgeDir.length()); - Vertex xAxis = coordinateSystem.getI().copy(); - double cosAngle = xAxis.dot(projEdgeDir); - if (cosAngle > 1 && cosAngle < 1.001) { - cosAngle = 1; - } else if (cosAngle < -1 && cosAngle > -1.001) { - cosAngle = -1; - } - double angle = Math.acos(cosAngle); - if (coordinateSystem.translate(projNotShared).getY() >= 0) { - angle = Math.PI - angle; - } else { - angle = Math.PI + angle; - } - return angle; - } - - /** - * Given a list of edges, L, one edge in the list, e, and one of this edge's - * vertices, v, finds the next edge in L which also contains v. If the edge found, e', - * is parrallel to e the first edge e'' in the direction of rotation from e to e' - * that is not parrallel to e is found. The end point of e'' that is not on a line - * parrallel to e is then returned. If no such vertex exists null is returned. - * @param edge the edge - * @param shared the shared vertex - * @param edges the list of edges - * @return the first non parrallel edge - */ - private Vertex findNextVertex(Edge edge, Vertex shared, LinkedList edges) { - int nextIndex = (edges.indexOf(edge) + 1) % edges.size(); - int lastIndex = ((edges.indexOf(edge) - 1) + edges.size()) % edges.size(); - Edge nextEdge = (Edge)edges.get(nextIndex); - Edge lastEdge = (Edge)edges.get(lastIndex); - int index; - int direction; - Edge nonParrallel; - Vertex notShared; - if (nextEdge.contains(shared)) { - nonParrallel = nextEdge; - notShared = nonParrallel.otherVertex(shared); - index = nextIndex; - direction = 1; - } else { - nonParrallel = lastEdge; - notShared = nonParrallel.otherVertex(shared); - index = lastIndex; - direction = -1; - } - boolean found = false; - while (!found && nonParrallel != edge) { - if (nonParrallel.getDirection().cross(edge.getDirection()).length() > 0.00001) { - found = true; - } else { - index = ((index + direction) + edges.size()) % edges.size(); - nonParrallel = (Edge)edges.get(index); - notShared = nonParrallel.otherVertex(notShared); - } - } - if (nonParrallel == edge) { - return null; - } else { - return notShared; - } - } - /** {@inheritDoc} */ @Override --- 1840,1843 ---- |
From: Michael L. <he...@us...> - 2007-12-12 10:41:09
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31495/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: Cut spacechecking code Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** GUI.java 9 Dec 2007 08:26:44 -0000 1.85 --- GUI.java 12 Dec 2007 10:41:11 -0000 1.86 *************** *** 42,46 **** import java.util.Collection; - import java.util.ConcurrentModificationException; import java.util.Iterator; import java.util.LinkedList; --- 42,45 ---- *************** *** 759,800 **** return closed; } - - /** - * Checks if spaces are closed. - */ - private class SpaceChecker extends Thread { - /** - * The constructor - */ - SpaceChecker() { - super(); - } - - /** - * The run - */ - @Override - public void run() { - while (true) { - try { - Iterator it = Project.getInstance().getSpaces().iterator(); - while (it.hasNext()) { - Space sp = (Space)it.next(); - if (sp.isClosed()) { - closedSpaces.add(sp); - } else { - closedSpaces.remove(sp); - } - } - sleep(1000); - } catch (ConcurrentModificationException e) { - //Something is done to the spaces while they are being checked. - log.info("Concurrent modification in spacechecker"); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - } /** --- 758,761 ---- |
From: Michael L. <he...@us...> - 2007-12-12 09:39:01
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5390/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Command.java Log Message: moved bounding sphere code to command Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** Camera.java 12 Dec 2007 09:34:16 -0000 1.51 --- Camera.java 12 Dec 2007 09:38:34 -0000 1.52 *************** *** 477,682 **** /** - * Represents a bounding box - * - */ - private static class BoundingBox { - private Vertex xmin; - private Vertex xmax; - private Vertex ymin; - private Vertex ymax; - private Vertex zmin; - private Vertex zmax; - - /** - * Constructs bounding box for - * @param vertices Collection - */ - public BoundingBox(Collection<Vertex> vertices) { - compute(vertices); - } - - /** - * Compute boudning box - * @param vertices collection of vertices - */ - public void compute(Collection<Vertex> vertices) { - xmin = new Vertex(Double.POSITIVE_INFINITY, - Double.POSITIVE_INFINITY, - Double.POSITIVE_INFINITY); - xmax = new Vertex(Double.NEGATIVE_INFINITY, - Double.NEGATIVE_INFINITY, - Double.NEGATIVE_INFINITY); - ymin = xmin; - ymax = xmax; - zmin = xmin; - zmax = xmax; - - for (Vertex current : vertices) { - if (current.x < xmin.x) { - xmin = current; - } - if (current.x > xmax.x) { - xmax = current; - } - if (current.y < ymin.y) { - ymin = current; - } - if (current.y > ymax.y) { - ymax = current; - } - if (current.z < zmin.z) { - zmin = current; - } - if (current.z > zmax.z) { - zmax = current; - } - } - } - - /** - * - * @return vertex - */ - public Vertex xmin() { - return xmin; - } - - /** - * - * @return vertex - */ - public Vertex xmax() { - return xmax; - } - - /** - * - * @return vertex - */ - public Vertex ymin() { - return ymin; - } - - /** - * - * @return vertex - */ - public Vertex ymax() { - return ymax; - } - - /** - * - * @return vertex - */ - public Vertex zmin() { - return zmin; - } - - /** - * - * @return vertex - */ - public Vertex zmax() { - return zmax; - } - } - - /** - * Represents a bounding sphere - * - */ - private static class BoundingSphere { - private Vertex center; - private double radius; - - /** - * Constructs a bounding sphere for specified vertices - * @param vertices collection of vertices - */ - public BoundingSphere(Collection<Vertex> vertices) { - compute(vertices); - } - - /** - * Constructs a bounding sphere - * @param center center - * @param radius radius - */ - public BoundingSphere(Vertex center, double radius) { - this.center = center; - this.radius = radius; - } - - /** - * Returns center - * @return center - */ - public Vertex center() { - return center; - } - - /** - * Returns radius - * @return radius - */ - public double radius() { - return radius; - } - - /** - * Compute a bounding sphere for specified vertices - * using Jack Ritters algorithm from Graphics Gems. - * @param vertices collection of vertices - */ - public void compute(Collection<Vertex> vertices) { - BoundingBox box = new BoundingBox(vertices); - - Vertex xmin = box.xmin(); - Vertex xmax = box.xmax(); - Vertex ymin = box.ymin(); - Vertex ymax = box.ymax(); - Vertex zmin = box.zmin(); - Vertex zmax = box.zmax(); - - Vertex xspan = xmax.minus(xmin); - Vertex yspan = ymax.minus(ymin); - Vertex zspan = zmax.minus(zmin); - - - double dia = xspan.length(); - Vertex v1 = xmin; - Vertex v2 = xmax; - - if (yspan.length() > dia) { - dia = yspan.length(); - v1 = ymin; - v2 = ymax; - } - if (zspan.length() > dia) { - dia = zspan.length(); - v1 = zmin; - v2 = zmax; - } - - center = v1.add(v2).scale(0.5); - radius = dia / 2; - - for (Vertex current : vertices) { - Vertex d = current.minus(center); - double length = d.length(); - if (length > radius) { - radius = (radius + length) / 2; - double diff = length - radius; - center = center.add(d.scale(diff / length)); - } - } - if (radius < 0.00001) { - radius = 0.1; - } - } - } - - /** * Moves the camera to a position where the entire model is visible. * @param aspect the acspect ratio of the view. --- 477,480 ---- *************** *** 700,706 **** if (!allVertices.isEmpty()) { ! BoundingSphere sphere = new BoundingSphere(allVertices); ! double radius = sphere.radius; ! Vertex modelCenter = sphere.center; //Setting up camera --- 498,504 ---- if (!allVertices.isEmpty()) { ! Command.BoundingSphere sphere = new Command.BoundingSphere(allVertices); ! double radius = sphere.radius(); ! Vertex modelCenter = sphere.center(); //Setting up camera Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** Command.java 11 Dec 2007 15:14:13 -0000 1.52 --- Command.java 12 Dec 2007 09:38:34 -0000 1.53 *************** *** 1866,1868 **** --- 1866,2070 ---- } } + + /** + * Represents a bounding box + * + */ + public static class BoundingBox { + private Vertex xmin; + private Vertex xmax; + private Vertex ymin; + private Vertex ymax; + private Vertex zmin; + private Vertex zmax; + + /** + * Constructs bounding box for + * @param vertices Collection + */ + public BoundingBox(Collection<Vertex> vertices) { + compute(vertices); + } + + /** + * Compute boudning box + * @param vertices collection of vertices + */ + public void compute(Collection<Vertex> vertices) { + xmin = new Vertex(Double.POSITIVE_INFINITY, + Double.POSITIVE_INFINITY, + Double.POSITIVE_INFINITY); + xmax = new Vertex(Double.NEGATIVE_INFINITY, + Double.NEGATIVE_INFINITY, + Double.NEGATIVE_INFINITY); + ymin = xmin; + ymax = xmax; + zmin = xmin; + zmax = xmax; + + for (Vertex current : vertices) { + if (current.x < xmin.x) { + xmin = current; + } + if (current.x > xmax.x) { + xmax = current; + } + if (current.y < ymin.y) { + ymin = current; + } + if (current.y > ymax.y) { + ymax = current; + } + if (current.z < zmin.z) { + zmin = current; + } + if (current.z > zmax.z) { + zmax = current; + } + } + } + + /** + * + * @return vertex + */ + public Vertex xmin() { + return xmin; + } + + /** + * + * @return vertex + */ + public Vertex xmax() { + return xmax; + } + + /** + * + * @return vertex + */ + public Vertex ymin() { + return ymin; + } + + /** + * + * @return vertex + */ + public Vertex ymax() { + return ymax; + } + + /** + * + * @return vertex + */ + public Vertex zmin() { + return zmin; + } + + /** + * + * @return vertex + */ + public Vertex zmax() { + return zmax; + } + } + + /** + * Represents a bounding sphere + * + */ + public static class BoundingSphere { + private Vertex center; + private double radius; + + /** + * Constructs a bounding sphere for specified vertices + * @param vertices collection of vertices + */ + public BoundingSphere(Collection<Vertex> vertices) { + compute(vertices); + } + + /** + * Constructs a bounding sphere + * @param center center + * @param radius radius + */ + public BoundingSphere(Vertex center, double radius) { + this.center = center; + this.radius = radius; + } + + /** + * Returns center + * @return center + */ + public Vertex center() { + return center; + } + + /** + * Returns radius + * @return radius + */ + public double radius() { + return radius; + } + + /** + * Compute a bounding sphere for specified vertices + * using Jack Ritters algorithm from Graphics Gems. + * @param vertices collection of vertices + */ + public void compute(Collection<Vertex> vertices) { + BoundingBox box = new BoundingBox(vertices); + + Vertex xmin = box.xmin(); + Vertex xmax = box.xmax(); + Vertex ymin = box.ymin(); + Vertex ymax = box.ymax(); + Vertex zmin = box.zmin(); + Vertex zmax = box.zmax(); + + Vertex xspan = xmax.minus(xmin); + Vertex yspan = ymax.minus(ymin); + Vertex zspan = zmax.minus(zmin); + + + double dia = xspan.length(); + Vertex v1 = xmin; + Vertex v2 = xmax; + + if (yspan.length() > dia) { + dia = yspan.length(); + v1 = ymin; + v2 = ymax; + } + if (zspan.length() > dia) { + dia = zspan.length(); + v1 = zmin; + v2 = zmax; + } + + center = v1.add(v2).scale(0.5); + radius = dia / 2; + + for (Vertex current : vertices) { + Vertex d = current.minus(center); + double length = d.length(); + if (length > radius) { + radius = (radius + length) / 2; + double diff = length - radius; + center = center.add(d.scale(diff / length)); + } + } + if (radius < 0.00001) { + radius = 0.1; + } + } + } } |
From: Michael L. <he...@us...> - 2007-12-12 09:34:14
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3767/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Log Message: clean up of bounding sphere code Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** Camera.java 11 Dec 2007 14:49:02 -0000 1.50 --- Camera.java 12 Dec 2007 09:34:16 -0000 1.51 *************** *** 481,548 **** */ private static class BoundingBox { ! private Vertex min; ! private Vertex max; ! ! /** ! * Constructs the bounding box ! * @param min minimum ! * @param max maximum ! */ ! public BoundingBox(Vertex min, Vertex max) { ! this.min = min; ! this.max = max; ! } ! ! /** ! * Returns minimum ! * @return minimum ! */ ! public Vertex min() { ! return min; ! } /** ! * Returns maximum ! * @return maximum */ ! public Vertex max() { ! return max; } /** ! * Computes bounding box * @param vertices collection of vertices - * @return bounding box */ ! public static BoundingBox from(Collection<Vertex> vertices) { ! double xmin = Double.MAX_VALUE; ! double xmax = Double.MIN_VALUE; ! double ymin = Double.MAX_VALUE; ! double ymax = Double.MIN_VALUE; ! double zmin = Double.MAX_VALUE; ! double zmax = Double.MIN_VALUE; for (Vertex current : vertices) { ! if (current.getX() < xmin) { ! xmin = current.getX(); } ! if (current.getX() > xmax) { ! xmax = current.getX(); } ! if (current.getY() < ymin) { ! ymin = current.getY(); } ! if (current.getY() > ymax) { ! ymax = current.getY(); } ! if (current.getZ() < zmin) { ! zmin = current.getZ(); } ! if (current.getZ() > zmax) { ! zmax = current.getZ(); } } ! Vertex min = new Vertex(xmin, ymin, zmin); ! Vertex max = new Vertex(xmax, ymax, zmax); ! return new BoundingBox(min, max); } } --- 481,583 ---- */ private static class BoundingBox { ! private Vertex xmin; ! private Vertex xmax; ! private Vertex ymin; ! private Vertex ymax; ! private Vertex zmin; ! private Vertex zmax; /** ! * Constructs bounding box for ! * @param vertices Collection */ ! public BoundingBox(Collection<Vertex> vertices) { ! compute(vertices); } /** ! * Compute boudning box * @param vertices collection of vertices */ ! public void compute(Collection<Vertex> vertices) { ! xmin = new Vertex(Double.POSITIVE_INFINITY, ! Double.POSITIVE_INFINITY, ! Double.POSITIVE_INFINITY); ! xmax = new Vertex(Double.NEGATIVE_INFINITY, ! Double.NEGATIVE_INFINITY, ! Double.NEGATIVE_INFINITY); ! ymin = xmin; ! ymax = xmax; ! zmin = xmin; ! zmax = xmax; ! for (Vertex current : vertices) { ! if (current.x < xmin.x) { ! xmin = current; } ! if (current.x > xmax.x) { ! xmax = current; } ! if (current.y < ymin.y) { ! ymin = current; } ! if (current.y > ymax.y) { ! ymax = current; } ! if (current.z < zmin.z) { ! zmin = current; } ! if (current.z > zmax.z) { ! zmax = current; } } ! } ! ! /** ! * ! * @return vertex ! */ ! public Vertex xmin() { ! return xmin; ! } ! ! /** ! * ! * @return vertex ! */ ! public Vertex xmax() { ! return xmax; ! } ! ! /** ! * ! * @return vertex ! */ ! public Vertex ymin() { ! return ymin; ! } ! ! /** ! * ! * @return vertex ! */ ! public Vertex ymax() { ! return ymax; ! } ! ! /** ! * ! * @return vertex ! */ ! public Vertex zmin() { ! return zmin; ! } ! ! /** ! * ! * @return vertex ! */ ! public Vertex zmax() { ! return zmax; } } *************** *** 557,560 **** --- 592,603 ---- /** + * Constructs a bounding sphere for specified vertices + * @param vertices collection of vertices + */ + public BoundingSphere(Collection<Vertex> vertices) { + compute(vertices); + } + + /** * Constructs a bounding sphere * @param center center *************** *** 583,619 **** /** ! * Computes an approximation of boundinsphere in linear time ! * Algorithm by Jack Ritter in "Graphics Gems" * @param vertices collection of vertices - * @return bounding sphere */ ! public static BoundingSphere from(Collection<Vertex> vertices) { ! Vertex xmin = new Vertex(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE); ! Vertex xmax = new Vertex(-10000, -10000, -10000); ! Vertex ymin = xmin; ! Vertex ymax = xmax; ! Vertex zmin = xmin; ! Vertex zmax = xmax; - for (Vertex current : vertices) { - if (current.x < xmin.x) { - xmin = current; - } - if (current.x > xmax.x) { - xmax = current; - } - if (current.y < ymin.y) { - ymin = current; - } - if (current.y > ymax.y) { - ymax = current; - } - if (current.z < zmin.z) { - zmin = current; - } - if (current.z > zmax.z) { - zmax = current; - } - } Vertex xspan = xmax.minus(xmin); Vertex yspan = ymax.minus(ymin); --- 626,643 ---- /** ! * Compute a bounding sphere for specified vertices ! * using Jack Ritters algorithm from Graphics Gems. * @param vertices collection of vertices */ ! public void compute(Collection<Vertex> vertices) { ! BoundingBox box = new BoundingBox(vertices); ! ! Vertex xmin = box.xmin(); ! Vertex xmax = box.xmax(); ! Vertex ymin = box.ymin(); ! Vertex ymax = box.ymax(); ! Vertex zmin = box.zmin(); ! Vertex zmax = box.zmax(); Vertex xspan = xmax.minus(xmin); Vertex yspan = ymax.minus(ymin); *************** *** 636,641 **** } ! Vertex center = v1.add(v2).scale(0.5); ! double radius = 0.1; for (Vertex current : vertices) { --- 660,665 ---- } ! center = v1.add(v2).scale(0.5); ! radius = dia / 2; for (Vertex current : vertices) { *************** *** 649,723 **** } if (radius < 0.00001) { ! radius = 0.5; ! } ! return new BoundingSphere(center, radius); ! } ! ! /** ! * Computes a crude approximation of boundinsphere in linear time ! * @param vertices collection of vertices ! * @return bounding sphere ! */ ! public static BoundingSphere from1(Collection<Vertex> vertices) { ! BoundingBox box = BoundingBox.from(vertices); ! Vertex v1 = box.min; ! Vertex v2 = box.max; ! Vertex center = v1.add(v2).scale(0.5); ! double radius = 0.0; ! for (Vertex current : vertices) { ! Vertex d = current.minus(center); ! if (d.length() > radius) { ! radius = d.length(); ! } ! } ! if (radius < 0.00001) { ! radius = 0.5; ! } ! return new BoundingSphere(center, radius); ! } ! ! ! /** ! * Computes an approximation of boundinsphere in quadratic time ! * @param vertices collection of vertices ! * @return bounding sphere ! */ ! public static BoundingSphere from0(Collection<Vertex> vertices) { ! Set<Vertex> notTested = new HashSet<Vertex>(vertices); ! double radius = 0; ! Vertex modelCenter = new Vertex(0, 0, 0); ! Vertex p1 = null; ! Vertex p2 = null; ! Iterator it = vertices.iterator(); ! while (it.hasNext()) { ! Vertex v = (Vertex) it.next(); ! notTested.remove(v); ! Iterator testIt = notTested.iterator(); ! while (testIt.hasNext()) { ! Vertex u = (Vertex)testIt.next(); ! if ((v.minus(u).length() / 2.0) > radius) { ! p1 = v; ! p2 = u; ! radius = v.minus(u).length() / 2.0; ! } ! } ! } ! if (p1 != null && p2 != null) { ! modelCenter = p1.minus(p2); ! modelCenter.scaleIt(1.0 / 2.0); ! modelCenter = modelCenter.add(p2); ! it = vertices.iterator(); ! while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! Vertex dV = v.minus(modelCenter); ! double dist = dV.length(); ! if (dist > radius) { ! radius = (dist + radius) / 2.0; ! dV.scaleIt((dist - radius) / dist); ! modelCenter = modelCenter.add(dV); ! } ! } } - return new BoundingSphere(modelCenter, radius); } } --- 673,678 ---- } if (radius < 0.00001) { ! radius = 0.1; } } } *************** *** 745,749 **** if (!allVertices.isEmpty()) { ! BoundingSphere sphere = BoundingSphere.from(allVertices); double radius = sphere.radius; Vertex modelCenter = sphere.center; --- 700,704 ---- if (!allVertices.isEmpty()) { ! BoundingSphere sphere = new BoundingSphere(allVertices); double radius = sphere.radius; Vertex modelCenter = sphere.center; |
From: Michael L. <he...@us...> - 2007-12-11 15:15:56
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2731/src/net/sourceforge/bprocessor/model Modified Files: Geometry.java Command.java Project.java CoordinateSystem.java Log Message: CoordinateSystem.translateIt/unTranslateIt translates in place Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** Command.java 11 Dec 2007 14:49:01 -0000 1.51 --- Command.java 11 Dec 2007 15:14:13 -0000 1.52 *************** *** 965,983 **** @Override public void evaluate() { ! List<Vertex> locals = system.translate(vertices); double sx = parameters.getDouble("scale x"); double sy = parameters.getDouble("scale y"); double sz = parameters.getDouble("scale z"); ! for (Vertex current : locals) { current.setX(current.getX() * sx); current.setY(current.getY() * sy); current.setZ(current.getZ() * sz); } ! locals = system.unTranslate(locals); ! for (int i = 0; i < locals.size(); i++) { ! Vertex v1 = vertices.get(i); ! Vertex v2 = locals.get(i); ! v1.set(v2); ! v1.update(); } } --- 965,980 ---- @Override public void evaluate() { ! system.translateIt(vertices); double sx = parameters.getDouble("scale x"); double sy = parameters.getDouble("scale y"); double sz = parameters.getDouble("scale z"); ! for (Vertex current : vertices) { current.setX(current.getX() * sx); current.setY(current.getY() * sy); current.setZ(current.getZ() * sz); } ! system.unTranslateIt(vertices); ! for (Vertex current : vertices) { ! current.update(); } } *************** *** 1009,1030 **** @Override public void evaluate() { ! ! List<Vertex> locals = system.translate(vertices); double sx = parameters.getDouble("translate x"); double sy = parameters.getDouble("translate y"); double sz = parameters.getDouble("translate z"); ! System.out.println("translate " + sx + ", " + sy + ", " + sz); ! for (Vertex current : locals) { current.setX(current.getX() + sx); current.setY(current.getY() + sy); current.setZ(current.getZ() + sz); } ! locals = system.unTranslate(locals); ! for (int i = 0; i < locals.size(); i++) { ! Vertex v1 = vertices.get(i); ! Vertex v2 = locals.get(i); ! v1.set(v2); ! v1.update(); } Project.getInstance().changed(Project.getInstance()); --- 1006,1022 ---- @Override public void evaluate() { ! system.translateIt(vertices); double sx = parameters.getDouble("translate x"); double sy = parameters.getDouble("translate y"); double sz = parameters.getDouble("translate z"); ! for (Vertex current : vertices) { current.setX(current.getX() + sx); current.setY(current.getY() + sy); current.setZ(current.getZ() + sz); } ! system.unTranslateIt(vertices); ! for (Vertex current : vertices) { ! current.update(); } Project.getInstance().changed(Project.getInstance()); *************** *** 1055,1072 **** @Override public void evaluate() { ! List<Vertex> locals = system.translate(vertices); double angle = parameters.getDouble("angle"); AxisRotate rotate = new AxisRotate(); rotate.angle(angle); ! for (Vertex current : locals) { Vertex rotated = rotate.transform(current); current.set(rotated); } ! locals = system.unTranslate(locals); ! for (int i = 0; i < locals.size(); i++) { ! Vertex v1 = vertices.get(i); ! Vertex v2 = locals.get(i); ! v1.set(v2); ! v1.update(); } Project.getInstance().changed(Project.getInstance()); --- 1047,1061 ---- @Override public void evaluate() { ! system.translateIt(vertices); double angle = parameters.getDouble("angle"); AxisRotate rotate = new AxisRotate(); rotate.angle(angle); ! for (Vertex current : vertices) { Vertex rotated = rotate.transform(current); current.set(rotated); } ! system.unTranslateIt(vertices); ! for (Vertex current : vertices) { ! current.update(); } Project.getInstance().changed(Project.getInstance()); *************** *** 1664,1673 **** List<Vertex> vertices = new LinkedList(Edge.vertices(contour)); ! List<Vertex> locals = system.translate(vertices); ! for (int i = 0; i < vertices.size(); i++) { ! Vertex current = vertices.get(i); ! Vertex local = locals.get(i); ! current.set(local); ! } double xmin = Double.MAX_VALUE; --- 1653,1657 ---- List<Vertex> vertices = new LinkedList(Edge.vertices(contour)); ! system.translateIt(vertices); double xmin = Double.MAX_VALUE; *************** *** 1675,1679 **** double ymin = Double.MAX_VALUE; double ymax = Double.MIN_VALUE; ! for (Vertex current : locals) { if (current.getX() < xmin) { xmin = current.getX(); --- 1659,1663 ---- double ymin = Double.MAX_VALUE; double ymax = Double.MIN_VALUE; ! for (Vertex current : vertices) { if (current.getX() < xmin) { xmin = current.getX(); *************** *** 1742,1763 **** } ! { ! List<Vertex> verts = new ArrayList(Edge.vertices(verticals)); ! List<Vertex> globals = system.unTranslate(verts); ! for (int i = 0; i < verts.size(); i++) { ! Vertex current = verts.get(i); ! Vertex global = globals.get(i); ! current.set(global); ! } ! } ! { ! List<Vertex> verts = new ArrayList(Edge.vertices(contour)); ! List<Vertex> globals = system.unTranslate(verts); ! for (int i = 0; i < verts.size(); i++) { ! Vertex current = verts.get(i); ! Vertex global = globals.get(i); ! current.set(global); ! } ! } Geometry.insertEdges(net, contour); Geometry.insertEdges(net, verticals); --- 1726,1731 ---- } ! system.unTranslateIt(Edge.vertices(verticals)); ! system.unTranslateIt(Edge.vertices(contour)); Geometry.insertEdges(net, contour); Geometry.insertEdges(net, verticals); Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Geometry.java 11 Dec 2007 14:49:01 -0000 1.67 --- Geometry.java 11 Dec 2007 15:14:13 -0000 1.68 *************** *** 991,1005 **** public static void unTranslateGeometry(Collection<? extends Geometric> geometry, CoordinateSystem system) { ! List<Vertex> vertices = new LinkedList<Vertex>(collect(geometry)); ! List<Vertex> unTranslatedVertices = system.unTranslate(vertices); ! Iterator it = vertices.iterator(); ! Iterator unTranslatedIt = unTranslatedVertices.iterator(); ! while (it.hasNext() && unTranslatedIt.hasNext()) { ! Vertex v = (Vertex)it.next(); ! Vertex vUnTranslated = (Vertex)unTranslatedIt.next(); ! v.setX(vUnTranslated.getX()); ! v.setY(vUnTranslated.getY()); ! v.setZ(vUnTranslated.getZ()); ! } } --- 991,995 ---- public static void unTranslateGeometry(Collection<? extends Geometric> geometry, CoordinateSystem system) { ! system.unTranslateIt(collect(geometry)); } Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** CoordinateSystem.java 11 Dec 2007 14:49:01 -0000 1.69 --- CoordinateSystem.java 11 Dec 2007 15:14:13 -0000 1.70 *************** *** 527,535 **** /** * Untranslate all vertices in the list * @param vertices The list of vertices * @return The untranslated list */ ! public List<Vertex> unTranslate(Collection<Vertex> vertices) { List<Vertex> result = new ArrayList<Vertex>(); for (Vertex current : vertices) { --- 527,545 ---- /** + * Translates a collection of vertices in place + * @param vertices list of vertices + */ + public void translateIt(Collection<Vertex> vertices) { + for (Vertex current : vertices) { + current.set(translate(current)); + } + } + + /** * Untranslate all vertices in the list * @param vertices The list of vertices * @return The untranslated list */ ! public List<Vertex> unTranslate(List<Vertex> vertices) { List<Vertex> result = new ArrayList<Vertex>(); for (Vertex current : vertices) { *************** *** 540,543 **** --- 550,564 ---- /** + * Untranslates a collection of vertices in place + * @param vertices collection of vertices + */ + public void unTranslateIt(Collection<Vertex> vertices) { + for (Vertex current : vertices) { + current.set(unTranslate(current)); + } + } + + + /** * Untranslate a surface * @param surface the surface Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.148 retrieving revision 1.149 diff -C2 -d -r1.148 -r1.149 *** Project.java 10 Dec 2007 23:10:04 -0000 1.148 --- Project.java 11 Dec 2007 15:14:13 -0000 1.149 *************** *** 211,215 **** currentCamera = new Camera("(Current)", new double[]{6, 3, 2}, ! new double[]{7, -12, 16}, new double[]{0, 0, 1}, Camera.PERSPECTIVE); } --- 211,215 ---- currentCamera = new Camera("(Current)", new double[]{6, 3, 2}, ! new double[]{7, -21, 24}, new double[]{0, 0, 1}, Camera.PERSPECTIVE); } |
From: Michael L. <he...@us...> - 2007-12-11 15:15:56
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2743/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: CoordinateSystem.translateIt/unTranslateIt translates in place Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** PopupMenu.java 7 Dec 2007 14:37:03 -0000 1.85 --- PopupMenu.java 11 Dec 2007 15:14:19 -0000 1.86 *************** *** 670,679 **** List<Vertex> vertices = new ArrayList(Geometry.collect(entities)); CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); ! List<Vertex> locals = system.unTranslate(vertices); ! for (int i = 0; i < locals.size(); i++) { ! Vertex v1 = vertices.get(i); ! Vertex v2 = locals.get(i); ! v1.set(v2); ! } for (Vertex current : vertices) { current.update(); --- 670,674 ---- List<Vertex> vertices = new ArrayList(Geometry.collect(entities)); CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); ! system.unTranslateIt(vertices); for (Vertex current : vertices) { current.update(); *************** *** 690,699 **** List<Vertex> vertices = new ArrayList(Geometry.collect(entities)); CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); ! List<Vertex> locals = system.translate(vertices); ! for (int i = 0; i < locals.size(); i++) { ! Vertex v1 = vertices.get(i); ! Vertex v2 = locals.get(i); ! v1.set(v2); ! } for (Vertex current : vertices) { current.update(); --- 685,689 ---- List<Vertex> vertices = new ArrayList(Geometry.collect(entities)); CoordinateSystem system = Project.getInstance().getActiveCoordinateSystem(); ! system.translateIt(vertices); for (Vertex current : vertices) { current.update(); |
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25364/src/net/sourceforge/bprocessor/gl/tool Modified Files: OffsetTool.java ExtrusionTool.java ClipplaneTool.java EdgeMoveTool.java FinalMoveTool.java AbstractPencil.java TapeMeasure.java AbstractTool.java CameraFlyTool.java ArcTool.java RectTool.java AltMoveTool.java CameraWalkTool.java ControlledMoveTool.java Log Message: renamed scaleInPlace to scaleIt Index: EdgeMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/EdgeMoveTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EdgeMoveTool.java 18 Nov 2007 21:30:17 -0000 1.6 --- EdgeMoveTool.java 11 Dec 2007 14:49:11 -0000 1.7 *************** *** 182,186 **** Vertex norm = ray.getDirection(); norm.normalize(); ! norm.scaleInPlace(-1); dragplane = new Plane(norm.getX(), norm.getY(), norm.getZ(), start.vertex()); } else { --- 182,186 ---- Vertex norm = ray.getDirection(); norm.normalize(); ! norm.scaleIt(-1); dragplane = new Plane(norm.getX(), norm.getY(), norm.getZ(), start.vertex()); } else { Index: OffsetTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/OffsetTool.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** OffsetTool.java 7 Dec 2007 12:48:31 -0000 1.26 --- OffsetTool.java 11 Dec 2007 14:49:11 -0000 1.27 *************** *** 119,127 **** if (offsetSurface.surrounds(current.vertex())) { if (outNormal.dot(current.vertex().minus(edgePoint)) > 0) { ! outNormal.scaleInPlace(-1); } } else { if (outNormal.dot(current.vertex().minus(edgePoint)) < 0) { ! outNormal.scaleInPlace(-1); } } --- 119,127 ---- if (offsetSurface.surrounds(current.vertex())) { if (outNormal.dot(current.vertex().minus(edgePoint)) > 0) { ! outNormal.scaleIt(-1); } } else { if (outNormal.dot(current.vertex().minus(edgePoint)) < 0) { ! outNormal.scaleIt(-1); } } *************** *** 136,145 **** if (s.surrounds(current.vertex())) { if (outNormal.dot(current.vertex().minus(edgePoint)) > 0) { ! outNormal.scaleInPlace(-1); } log.debug("Surrounds"); } else { if (outNormal.dot(current.vertex().minus(edgePoint)) < 0) { ! outNormal.scaleInPlace(-1); } } --- 136,145 ---- if (s.surrounds(current.vertex())) { if (outNormal.dot(current.vertex().minus(edgePoint)) > 0) { ! outNormal.scaleIt(-1); } log.debug("Surrounds"); } else { if (outNormal.dot(current.vertex().minus(edgePoint)) < 0) { ! outNormal.scaleIt(-1); } } *************** *** 201,205 **** Direction d = directionMap.get(origin); Vertex moveDelta = d.getDirection().copy(); ! moveDelta.scaleInPlace(length); Vertex to = origin.add(moveDelta); d.getVertex().set(to); --- 201,205 ---- Direction d = directionMap.get(origin); Vertex moveDelta = d.getDirection().copy(); ! moveDelta.scaleIt(length); Vertex to = origin.add(moveDelta); d.getVertex().set(to); Index: ClipplaneTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ClipplaneTool.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ClipplaneTool.java 18 Nov 2007 21:30:17 -0000 1.15 --- ClipplaneTool.java 11 Dec 2007 14:49:11 -0000 1.16 *************** *** 59,63 **** boolean front = editor.getView().facingFront(system); if (front) { ! n.scaleInPlace(-1); } system = new CoordinateSystem(i, j, n, o); --- 59,63 ---- boolean front = editor.getView().facingFront(system); if (front) { ! n.scaleIt(-1); } system = new CoordinateSystem(i, j, n, o); Index: ControlledMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledMoveTool.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ControlledMoveTool.java 18 Nov 2007 21:30:17 -0000 1.12 --- ControlledMoveTool.java 11 Dec 2007 14:49:11 -0000 1.13 *************** *** 248,252 **** Vertex normal = surface.normal(); Vertex dir = edgeDir.cross(normal); ! dir.scaleInPlace(1 / dir.length()); return dir; } --- 248,252 ---- Vertex normal = surface.normal(); Vertex dir = edgeDir.cross(normal); ! dir.scaleIt(1 / dir.length()); return dir; } *************** *** 266,280 **** if (slideMap != null && slideMap.keySet().containsAll(vertices)) { Vertex directionCopy = direction.copy(); ! directionCopy.scaleInPlace(1 / directionCopy.length()); ! directionCopy.scaleInPlace(delta.dot(directionCopy)); delta = directionCopy; if (delta.length() != 0) { Vertex deltaUnit = delta.copy(); ! deltaUnit.scaleInPlace(1 / delta.length()); Iterator it = vertices.iterator(); while (it.hasNext()) { Vertex vertex = (Vertex)it.next(); Vertex slideDir = ((Vertex)slideMap.get(vertex)).copy(); ! slideDir.scaleInPlace(1 / slideDir.length()); double slideScale; if (delta == null) { --- 266,280 ---- if (slideMap != null && slideMap.keySet().containsAll(vertices)) { Vertex directionCopy = direction.copy(); ! directionCopy.scaleIt(1 / directionCopy.length()); ! directionCopy.scaleIt(delta.dot(directionCopy)); delta = directionCopy; if (delta.length() != 0) { Vertex deltaUnit = delta.copy(); ! deltaUnit.scaleIt(1 / delta.length()); Iterator it = vertices.iterator(); while (it.hasNext()) { Vertex vertex = (Vertex)it.next(); Vertex slideDir = ((Vertex)slideMap.get(vertex)).copy(); ! slideDir.scaleIt(1 / slideDir.length()); double slideScale; if (delta == null) { *************** *** 294,298 **** slideScale = delta.getZ() / (slideDir.dot(deltaUnit) * deltaUnit.getZ()); } ! slideDir.scaleInPlace(slideScale); vertex.move(slideDir.getX(), slideDir.getY(), slideDir.getZ()); } --- 294,298 ---- slideScale = delta.getZ() / (slideDir.dot(deltaUnit) * deltaUnit.getZ()); } ! slideDir.scaleIt(slideScale); vertex.move(slideDir.getX(), slideDir.getY(), slideDir.getZ()); } Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** ExtrusionTool.java 7 Dec 2007 12:48:31 -0000 1.73 --- ExtrusionTool.java 11 Dec 2007 14:49:11 -0000 1.74 *************** *** 443,447 **** Vertex dir = to.minus(from); dir.normalize(); ! dir.scaleInPlace(length); to = from.add(dir); } else { --- 443,447 ---- Vertex dir = to.minus(from); dir.normalize(); ! dir.scaleIt(length); to = from.add(dir); } else { Index: TapeMeasure.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasure.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TapeMeasure.java 7 Dec 2007 12:48:31 -0000 1.10 --- TapeMeasure.java 11 Dec 2007 14:49:11 -0000 1.11 *************** *** 61,65 **** Vertex projected = current.vertex().minus(origin); double t = normal.dot(projected); ! normal.scaleInPlace(t); projected = projected.minus(normal); Edge ortho = new Edge(origin, origin.add(projected)); --- 61,65 ---- Vertex projected = current.vertex().minus(origin); double t = normal.dot(projected); ! normal.scaleIt(t); projected = projected.minus(normal); Edge ortho = new Edge(origin, origin.add(projected)); *************** *** 162,166 **** Vertex direction = lengthEdge.getDirection(); direction.normalize(); ! direction.scaleInPlace(value); Vertex origin = start.vertex().add(direction); Vertex v = originalEdge.getDirection(); --- 162,166 ---- Vertex direction = lengthEdge.getDirection(); direction.normalize(); ! direction.scaleIt(value); Vertex origin = start.vertex().add(direction); Vertex v = originalEdge.getDirection(); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -d -r1.141 -r1.142 *** AbstractTool.java 10 Dec 2007 11:55:54 -0000 1.141 --- AbstractTool.java 11 Dec 2007 14:49:11 -0000 1.142 *************** *** 300,307 **** double z = c.getCenter()[2] - c.getCamera()[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleInPlace(2 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleInPlace(2 / sidewards.length()); ! up.scaleInPlace(2 / up.length()); --- 300,307 ---- double z = c.getCenter()[2] - c.getCamera()[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleIt(2 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleIt(2 / sidewards.length()); ! up.scaleIt(2 / up.length()); Index: ArcTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ArcTool.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ArcTool.java 7 Dec 2007 12:48:31 -0000 1.23 --- ArcTool.java 11 Dec 2007 14:49:11 -0000 1.24 *************** *** 85,89 **** Vertex v1 = m.minus(p); ! v1.scaleInPlace(0.5); Vertex m1 = p.add(v1); --- 85,89 ---- Vertex v1 = m.minus(p); ! v1.scaleIt(0.5); Vertex m1 = p.add(v1); *************** *** 92,100 **** v1.setX(-y); v1.setY(x); ! v1.scaleInPlace(10 / v1.length()); Edge l1 = new Edge(m1.minus(v1), m1.add(v1)); Vertex v2 = m.minus(q); ! v2.scaleInPlace(0.5); Vertex m2 = q.add(v2); --- 92,100 ---- v1.setX(-y); v1.setY(x); ! v1.scaleIt(10 / v1.length()); Edge l1 = new Edge(m1.minus(v1), m1.add(v1)); Vertex v2 = m.minus(q); ! v2.scaleIt(0.5); Vertex m2 = q.add(v2); *************** *** 103,107 **** v2.setX(-y); v2.setY(x); ! v2.scaleInPlace(10 / v2.length()); Edge l2 = new Edge(m2.minus(v2), m2.add(v2)); l1.setStrippled(true); --- 103,107 ---- v2.setX(-y); v2.setY(x); ! v2.scaleIt(10 / v2.length()); Edge l2 = new Edge(m2.minus(v2), m2.add(v2)); l1.setStrippled(true); *************** *** 117,121 **** Vertex u1 = p.minus(center); radius = u1.length(); ! u1.scaleInPlace(1 / radius); tetra1 = Math.acos(u1.getX()); if (u1.getY() < 0) { --- 117,121 ---- Vertex u1 = p.minus(center); radius = u1.length(); ! u1.scaleIt(1 / radius); tetra1 = Math.acos(u1.getX()); if (u1.getY() < 0) { *************** *** 123,127 **** } Vertex u2 = q.minus(center); ! u2.scaleInPlace(1 / radius); tetra2 = Math.acos(u2.getX()); if (u2.getY() < 0) { --- 123,127 ---- } Vertex u2 = q.minus(center); ! u2.scaleIt(1 / radius); tetra2 = Math.acos(u2.getX()); if (u2.getY() < 0) { *************** *** 213,217 **** end = current; Vertex between = end.vertex().minus(first.vertex()); ! between.scaleInPlace(0.5); start = new Intersection(first.vertex().add(between), Intersection.VERTEX, null); } else { --- 213,217 ---- end = current; Vertex between = end.vertex().minus(first.vertex()); ! between.scaleIt(0.5); start = new Intersection(first.vertex().add(between), Intersection.VERTEX, null); } else { Index: CameraWalkTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraWalkTool.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** CameraWalkTool.java 18 Nov 2007 21:30:17 -0000 1.11 --- CameraWalkTool.java 11 Dec 2007 14:49:11 -0000 1.12 *************** *** 83,89 **** double z = c.getCenter()[2] - c.getCamera()[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleInPlace(2 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleInPlace(2 / sidewards.length()); if (e.getKeyCode() == KeyEvent.VK_UP) { --- 83,89 ---- double z = c.getCenter()[2] - c.getCamera()[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleIt(2 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleIt(2 / sidewards.length()); if (e.getKeyCode() == KeyEvent.VK_UP) { Index: CameraFlyTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraFlyTool.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CameraFlyTool.java 18 Nov 2007 21:30:17 -0000 1.13 --- CameraFlyTool.java 11 Dec 2007 14:49:11 -0000 1.14 *************** *** 84,90 **** double z = c.getCenter()[2] - c.getCamera()[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleInPlace(2 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleInPlace(2 / sidewards.length()); if (e.getKeyCode() == KeyEvent.VK_UP) { --- 84,90 ---- double z = c.getCenter()[2] - c.getCamera()[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleIt(2 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleIt(2 / sidewards.length()); if (e.getKeyCode() == KeyEvent.VK_UP) { Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** FinalMoveTool.java 10 Dec 2007 08:34:25 -0000 1.39 --- FinalMoveTool.java 11 Dec 2007 14:49:11 -0000 1.40 *************** *** 307,311 **** Vertex v = to.minus(current); double length = v.length(); ! v.scaleInPlace(1 / length); direction = new Direction(current.copy(), v, Double.NEGATIVE_INFINITY, length); } else { --- 307,311 ---- Vertex v = to.minus(current); double length = v.length(); ! v.scaleIt(1 / length); direction = new Direction(current.copy(), v, Double.NEGATIVE_INFINITY, length); } else { *************** *** 353,357 **** } Vertex u = n.copy(); ! u.scaleInPlace(t); current.set(original.add(u)); } --- 353,357 ---- } Vertex u = n.copy(); ! u.scaleIt(t); current.set(original.add(u)); } *************** *** 433,437 **** private void multiply(int i) { Vertex v = direction.copy(); ! v.scaleInPlace(i); Mesh copy = mesh.copyAndAssign(new HashMap()); for (Vertex current : copy.vertices()) { --- 433,437 ---- private void multiply(int i) { Vertex v = direction.copy(); ! v.scaleIt(i); Mesh copy = mesh.copyAndAssign(new HashMap()); for (Vertex current : copy.vertices()) { *************** *** 448,452 **** double d = (double) i * delta; ! v.scaleInPlace(d / v.length()); Mesh copy = mesh.copyAndAssign(new HashMap()); for (Vertex current : copy.vertices()) { --- 448,452 ---- double d = (double) i * delta; ! v.scaleIt(d / v.length()); Mesh copy = mesh.copyAndAssign(new HashMap()); for (Vertex current : copy.vertices()) { Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** AbstractPencil.java 18 Nov 2007 21:30:17 -0000 1.100 --- AbstractPencil.java 11 Dec 2007 14:49:11 -0000 1.101 *************** *** 737,741 **** Vertex v = current.vertex().minus(before); if (v.length() > Geometry.EPS) { ! v.scaleInPlace(length / v.length()); Vertex to = before.add(v); current = new Intersection(to, Intersection.VERTEX, to); --- 737,741 ---- Vertex v = current.vertex().minus(before); if (v.length() > Geometry.EPS) { ! v.scaleIt(length / v.length()); Vertex to = before.add(v); current = new Intersection(to, Intersection.VERTEX, to); Index: AltMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AltMoveTool.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AltMoveTool.java 18 Nov 2007 21:30:17 -0000 1.15 --- AltMoveTool.java 11 Dec 2007 14:49:11 -0000 1.16 *************** *** 92,96 **** Vertex normal = system.getN().copy(); double distance = normal.dot(delta); ! normal.scaleInPlace(distance); Vertex to = from.add(normal); makeTarget(current); --- 92,96 ---- Vertex normal = system.getN().copy(); double distance = normal.dot(delta); ! normal.scaleIt(distance); Vertex to = from.add(normal); makeTarget(current); Index: RectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RectTool.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** RectTool.java 7 Dec 2007 12:48:31 -0000 1.28 --- RectTool.java 11 Dec 2007 14:49:11 -0000 1.29 *************** *** 79,84 **** Vertex delta = lastCurrent.minus(current.vertex()); Vertex baseProjection = baseEdge.getDirection(); ! baseProjection.scaleInPlace(1 / baseProjection.length()); ! baseProjection.scaleInPlace(delta.dot(baseProjection)); Vertex movement = baseProjection.minus(delta); movingEdge.move(movement.getX(), movement.getY(), movement.getZ()); --- 79,84 ---- Vertex delta = lastCurrent.minus(current.vertex()); Vertex baseProjection = baseEdge.getDirection(); ! baseProjection.scaleIt(1 / baseProjection.length()); ! baseProjection.scaleIt(delta.dot(baseProjection)); Vertex movement = baseProjection.minus(delta); movingEdge.move(movement.getX(), movement.getY(), movement.getZ()); *************** *** 100,104 **** double length = start.vertex().minus(current.vertex()).length(); Vertex direction = movingEdge.getFrom().minus(baseEdge.getTo()); ! direction.scaleInPlace((length - direction.length()) / direction.length()); movingEdge.move(direction.getX(), direction.getY(), direction.getZ()); Geometry.insertEdges(rectangle); --- 100,104 ---- double length = start.vertex().minus(current.vertex()).length(); Vertex direction = movingEdge.getFrom().minus(baseEdge.getTo()); ! direction.scaleIt((length - direction.length()) / direction.length()); movingEdge.move(direction.getX(), direction.getY(), direction.getZ()); Geometry.insertEdges(rectangle); |
From: Michael L. <he...@us...> - 2007-12-11 14:49:09
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24969/src/net/sourceforge/bprocessor/model Modified Files: Direction.java Geometry.java Line.java EnergyCalc.java Command.java CoordinateSystem.java Edge.java Vertex.java ClippingPlane.java SpaceAnalysis.java Surface.java Camera.java Space.java Plane.java Log Message: renamed scaleInPlace to scaleIt Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** Command.java 9 Dec 2007 12:10:32 -0000 1.50 --- Command.java 11 Dec 2007 14:49:01 -0000 1.51 *************** *** 687,691 **** double length = v.length(); double delta = length / n; ! v.scaleInPlace(delta / length); Vertex current = from; Space space = edge.getOwner(); --- 687,691 ---- double length = v.length(); double delta = length / n; ! v.scaleIt(delta / length); Vertex current = from; Space space = edge.getOwner(); *************** *** 752,756 **** Vertex normal = v.copy(); normal.setZ(0); ! normal.scaleInPlace(-1); normal.normalize(); normals.add(normal); --- 752,756 ---- Vertex normal = v.copy(); normal.setZ(0); ! normal.scaleIt(-1); normal.normalize(); normals.add(normal); *************** *** 1602,1606 **** private Prism extrude(Surface bottom, double distance) { Vertex normal = bottom.normal(); ! normal.scaleInPlace(distance); HashMap map = new HashMap(); Surface top = (Surface) bottom.copy(map); --- 1602,1606 ---- private Prism extrude(Surface bottom, double distance) { Vertex normal = bottom.normal(); ! normal.scaleIt(distance); HashMap map = new HashMap(); Surface top = (Surface) bottom.copy(map); Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** CoordinateSystem.java 10 Dec 2007 08:34:21 -0000 1.68 --- CoordinateSystem.java 11 Dec 2007 14:49:01 -0000 1.69 *************** *** 358,368 **** Vertex origin = v0; Vertex i = v1.minus(v0); ! i.scaleInPlace(1 / i.length()); Vertex v = v2.minus(v1); Vertex n = i.cross(v); if (n.length() > 0) { ! n.scaleInPlace(1 / n.length()); Vertex j = n.cross(i); ! j.scaleInPlace(1 / j.length()); return new CoordinateSystem(i, j, n, origin); } else { --- 358,368 ---- Vertex origin = v0; Vertex i = v1.minus(v0); ! i.scaleIt(1 / i.length()); Vertex v = v2.minus(v1); Vertex n = i.cross(v); if (n.length() > 0) { ! n.scaleIt(1 / n.length()); Vertex j = n.cross(i); ! j.scaleIt(1 / j.length()); return new CoordinateSystem(i, j, n, origin); } else { *************** *** 439,443 **** projection.setZ(n.getZ()); double scalar = n.dot(vector); ! projection.scaleInPlace(scalar); return projection; } --- 439,443 ---- projection.setZ(n.getZ()); double scalar = n.dot(vector); ! projection.scaleIt(scalar); return projection; } *************** *** 463,467 **** double t = vector.dot(n); Vertex normal = n.copy(); ! normal.scaleInPlace(t); vector = vector.minus(normal); return origin.add(vector); --- 463,467 ---- double t = vector.dot(n); Vertex normal = n.copy(); ! normal.scaleIt(t); vector = vector.minus(normal); return origin.add(vector); *************** *** 504,512 **** public Vertex unTranslate(Vertex vertex) { Vertex ii = i.copy(); ! ii.scaleInPlace(vertex.getX()); Vertex jj = j.copy(); ! jj.scaleInPlace(vertex.getY()); Vertex nn = n.copy(); ! nn.scaleInPlace(vertex.getZ()); Vertex result = getOrigin().add(ii).add(jj).add(nn); return result; --- 504,512 ---- public Vertex unTranslate(Vertex vertex) { Vertex ii = i.copy(); ! ii.scaleIt(vertex.getX()); Vertex jj = j.copy(); ! jj.scaleIt(vertex.getY()); Vertex nn = n.copy(); ! nn.scaleIt(vertex.getZ()); Vertex result = getOrigin().add(ii).add(jj).add(nn); return result; *************** *** 632,638 **** Vertex nn = n.copy(); Vertex newI = coordinate.i; ! ii.scaleInPlace(newI.getX()); ! jj.scaleInPlace(newI.getY()); ! nn.scaleInPlace(newI.getZ()); newI = ii.add(jj).add(nn); --- 632,638 ---- Vertex nn = n.copy(); Vertex newI = coordinate.i; ! ii.scaleIt(newI.getX()); ! jj.scaleIt(newI.getY()); ! nn.scaleIt(newI.getZ()); newI = ii.add(jj).add(nn); *************** *** 641,647 **** nn = n.copy(); Vertex newJ = coordinate.j; ! ii.scaleInPlace(newJ.getX()); ! jj.scaleInPlace(newJ.getY()); ! nn.scaleInPlace(newJ.getZ()); newJ = ii.add(jj).add(nn); --- 641,647 ---- nn = n.copy(); Vertex newJ = coordinate.j; ! ii.scaleIt(newJ.getX()); ! jj.scaleIt(newJ.getY()); ! nn.scaleIt(newJ.getZ()); newJ = ii.add(jj).add(nn); *************** *** 650,656 **** nn = n.copy(); Vertex newN = coordinate.n; ! ii.scaleInPlace(newN.getX()); ! jj.scaleInPlace(newN.getY()); ! nn.scaleInPlace(newN.getZ()); newN = ii.add(jj).add(nn); Vertex origin = unTranslate(coordinate.origin); --- 650,656 ---- nn = n.copy(); Vertex newN = coordinate.n; ! ii.scaleIt(newN.getX()); ! jj.scaleIt(newN.getY()); ! nn.scaleIt(newN.getZ()); newN = ii.add(jj).add(nn); Vertex origin = unTranslate(coordinate.origin); *************** *** 772,777 **** Vertex v = i.copy(); Vertex u = j.copy(); ! v.scaleInPlace(size); ! u.scaleInPlace(size); Vertex a = origin.add(u).minus(v); Vertex b = origin.add(u).add(v); --- 772,777 ---- Vertex v = i.copy(); Vertex u = j.copy(); ! v.scaleIt(size); ! u.scaleIt(size); Vertex a = origin.add(u).minus(v); Vertex b = origin.add(u).add(v); *************** *** 833,842 **** Vertex o = getOrigin(); Vertex i = getI().copy(); ! i.scaleInPlace(size); Vertex from = o.minus(i); Vertex to = o.add(i); list.add(new Guide(from, to)); Vertex j = getJ().copy(); ! j.scaleInPlace(size); from = o.minus(j); to = o.add(j); --- 833,842 ---- Vertex o = getOrigin(); Vertex i = getI().copy(); ! i.scaleIt(size); Vertex from = o.minus(i); Vertex to = o.add(i); list.add(new Guide(from, to)); Vertex j = getJ().copy(); ! j.scaleIt(size); from = o.minus(j); to = o.add(j); *************** *** 844,848 **** if (!onlyPlane()) { Vertex n = getN().copy(); ! n.scaleInPlace(size); from = o.minus(n); to = o.add(n); --- 844,848 ---- if (!onlyPlane()) { Vertex n = getN().copy(); ! n.scaleIt(size); from = o.minus(n); to = o.add(n); *************** *** 892,896 **** i = j; j = tmp; ! n.scaleInPlace(-1); } --- 892,896 ---- i = j; j = tmp; ! n.scaleIt(-1); } *************** *** 996,1000 **** this.vector = vector; Vertex v = vector.copy(); ! v.scaleInPlace(distance); v = getOrigin().add(v); setX(v.getX()); --- 996,1000 ---- this.vector = vector; Vertex v = vector.copy(); ! v.scaleIt(distance); v = getOrigin().add(v); setX(v.getX()); Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.207 retrieving revision 1.208 diff -C2 -d -r1.207 -r1.208 *** Surface.java 21 Nov 2007 09:21:52 -0000 1.207 --- Surface.java 11 Dec 2007 14:49:02 -0000 1.208 *************** *** 626,630 **** public Surface extrusion(double delta, Collection sides) { Vertex normal = normal(); ! normal.scaleInPlace(delta); List vertices = getVertices(); List edges = getEdges(); --- 626,630 ---- public Surface extrusion(double delta, Collection sides) { Vertex normal = normal(); ! normal.scaleIt(delta); List vertices = getVertices(); List edges = getEdges(); *************** *** 794,798 **** } else { Vertex ncopy = normal.copy(); ! ncopy.scaleInPlace(distance); vmap[i] = v[i].copy().add(ncopy); } --- 794,798 ---- } else { Vertex ncopy = normal.copy(); ! ncopy.scaleIt(distance); vmap[i] = v[i].copy().add(ncopy); } *************** *** 1615,1622 **** origin = getFirstVertex(); i = e0.otherVertex(origin).minus(origin); ! i.scaleInPlace(1 / i.length()); j = n.cross(i); if (j != null) { ! j.scaleInPlace(1 / j.length()); return new CoordinateSystem(i, j, n, origin.copy()); } --- 1615,1622 ---- origin = getFirstVertex(); i = e0.otherVertex(origin).minus(origin); ! i.scaleIt(1 / i.length()); j = n.cross(i); if (j != null) { ! j.scaleIt(1 / j.length()); return new CoordinateSystem(i, j, n, origin.copy()); } Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** Edge.java 23 Nov 2007 10:27:12 -0000 1.102 --- Edge.java 11 Dec 2007 14:49:02 -0000 1.103 *************** *** 471,475 **** Vertex w = vertex.minus(from); double t = v.dot(w); ! v.scaleInPlace(t / (length * length)); return from.add(v); } --- 471,475 ---- Vertex w = vertex.minus(from); double t = v.dot(w); ! v.scaleIt(t / (length * length)); return from.add(v); } *************** *** 607,611 **** } if ((t > 0 && t < 1)) { ! r.scaleInPlace(t); Vertex p = p0.add(r).minus(q); if (p.length() < 0.0000001) { --- 607,611 ---- } if ((t > 0 && t < 1)) { ! r.scaleIt(t); Vertex p = p0.add(r).minus(q); if (p.length() < 0.0000001) { *************** *** 635,639 **** t = (q.getZ() - p0.getZ()) / r.getZ(); } ! r.scaleInPlace(t); Vertex p = p0.add(r).minus(q); if (p.length() < 0.0000001) { --- 635,639 ---- t = (q.getZ() - p0.getZ()) / r.getZ(); } ! r.scaleIt(t); Vertex p = p0.add(r).minus(q); if (p.length() < 0.0000001) { *************** *** 771,780 **** org1 = dir1.cross(normal); org1.normalize(); ! org1.scaleInPlace(((Double)offsetMap.get(e1)).doubleValue()); } if (which.contains(e2)) { org2 = dir2.cross(normal); org2.normalize(); ! org2.scaleInPlace(((Double)offsetMap.get(e2)).doubleValue()); } org1 = org1.add(work); --- 771,780 ---- org1 = dir1.cross(normal); org1.normalize(); ! org1.scaleIt(((Double)offsetMap.get(e1)).doubleValue()); } if (which.contains(e2)) { org2 = dir2.cross(normal); org2.normalize(); ! org2.scaleIt(((Double)offsetMap.get(e2)).doubleValue()); } org1 = org1.add(work); *************** *** 801,805 **** scale = ((Double)offsetMap.get(e2)).doubleValue(); } ! mainDir.scaleInPlace(scale); } v2Dir.put(work, mainDir); --- 801,805 ---- scale = ((Double)offsetMap.get(e2)).doubleValue(); } ! mainDir.scaleIt(scale); } v2Dir.put(work, mainDir); *************** *** 863,867 **** Vertex workDir = (Vertex)directions.get(work); workDir.normalize(); ! workDir.scaleInPlace(((Double)offsetMap.get(e1)).doubleValue() / workDir.dot(dir1)); ((Vertex)v2v.get(work)).move(workDir.getX(), workDir.getY(), workDir.getZ()); --- 863,867 ---- Vertex workDir = (Vertex)directions.get(work); workDir.normalize(); ! workDir.scaleIt(((Double)offsetMap.get(e1)).doubleValue() / workDir.dot(dir1)); ((Vertex)v2v.get(work)).move(workDir.getX(), workDir.getY(), workDir.getZ()); *************** *** 872,876 **** Vertex workDir = (Vertex)directions.get(work); workDir.normalize(); ! workDir.scaleInPlace(((Double)offsetMap.get(e2)).doubleValue() / workDir.dot(dir2)); ((Vertex)v2v.get(work)).move(workDir.getX(), workDir.getY(), workDir.getZ()); --- 872,876 ---- Vertex workDir = (Vertex)directions.get(work); workDir.normalize(); ! workDir.scaleIt(((Double)offsetMap.get(e2)).doubleValue() / workDir.dot(dir2)); ((Vertex)v2v.get(work)).move(workDir.getX(), workDir.getY(), workDir.getZ()); *************** *** 1004,1008 **** dir2.normalize(); Vertex mainDir = dir1.add(dir2); ! mainDir.scaleInPlace(1 / mainDir.dot(dir1)); dir.setDirection(mainDir); } else { --- 1004,1008 ---- dir2.normalize(); Vertex mainDir = dir1.add(dir2); ! mainDir.scaleIt(1 / mainDir.dot(dir1)); dir.setDirection(mainDir); } else { *************** *** 1022,1026 **** Vertex dir2 = other.minus(work); dir2.normalize(); ! dir2.scaleInPlace(1 / dir2.dot(dir1)); dir.setDirection(dir2); } else { --- 1022,1026 ---- Vertex dir2 = other.minus(work); dir2.normalize(); ! dir2.scaleIt(1 / dir2.dot(dir1)); dir.setDirection(dir2); } else { *************** *** 1044,1048 **** Vertex dir1 = other.minus(work); dir1.normalize(); ! dir1.scaleInPlace(1 / dir1.dot(dir2)); dir.setDirection(dir1); } else { --- 1044,1048 ---- Vertex dir1 = other.minus(work); dir1.normalize(); ! dir1.scaleIt(1 / dir1.dot(dir2)); dir.setDirection(dir1); } else { *************** *** 1059,1065 **** Direction cur = (Direction)diriter.next(); Vertex dir = cur.getDirection(); ! dir.scaleInPlace(-1); dir = dir.copy(); ! dir.scaleInPlace(offset); cur.getVertex().move(dir.getX(), dir.getY(), dir.getZ()); } --- 1059,1065 ---- Direction cur = (Direction)diriter.next(); Vertex dir = cur.getDirection(); ! dir.scaleIt(-1); dir = dir.copy(); ! dir.scaleIt(offset); cur.getVertex().move(dir.getX(), dir.getY(), dir.getZ()); } Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ClippingPlane.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ClippingPlane.java 16 Nov 2007 11:46:50 -0000 1.24 --- ClippingPlane.java 11 Dec 2007 14:49:02 -0000 1.25 *************** *** 86,90 **** Vertex n = c.getN().copy(); n.normalize(); ! n.scaleInPlace(0.00001); c.move(n.getX(), n.getY(), n.getZ()); plane = c.plane(); --- 86,90 ---- Vertex n = c.getN().copy(); n.normalize(); ! n.scaleIt(0.00001); c.move(n.getX(), n.getY(), n.getZ()); plane = c.plane(); Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** Camera.java 11 Dec 2007 14:34:07 -0000 1.49 --- Camera.java 11 Dec 2007 14:49:02 -0000 1.50 *************** *** 388,397 **** public static void rotateHorizontallyEye(Camera c, double angle) { Vertex up = new Vertex(c.roll[0], c.roll[1], c.roll[2]); ! up.scaleInPlace(1 / up.length()); double x = c.center[0] - c.camera[0]; double y = c.center[1] - c.camera[1]; double z = c.center[2] - c.camera[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleInPlace(1 / forward.length()); Geometry.rotate(angle, 0, 0, 1, c.center, c.camera); Geometry.rotate(angle, 0, 0, 1, c.roll, new double[]{0, 0, 0}); --- 388,397 ---- public static void rotateHorizontallyEye(Camera c, double angle) { Vertex up = new Vertex(c.roll[0], c.roll[1], c.roll[2]); ! up.scaleIt(1 / up.length()); double x = c.center[0] - c.camera[0]; double y = c.center[1] - c.camera[1]; double z = c.center[2] - c.camera[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleIt(1 / forward.length()); Geometry.rotate(angle, 0, 0, 1, c.center, c.camera); Geometry.rotate(angle, 0, 0, 1, c.roll, new double[]{0, 0, 0}); *************** *** 405,416 **** public static void rotateVerticallyEye(Camera c, double angle) { Vertex up = new Vertex(c.roll[0], c.roll[1], c.roll[2]); ! up.scaleInPlace(1 / up.length()); double x = c.center[0] - c.camera[0]; double y = c.center[1] - c.camera[1]; double z = c.center[2] - c.camera[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleInPlace(1 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleInPlace(1 / sidewards.length()); Geometry.rotate(angle, sidewards.getX(), sidewards.getY(), sidewards.getZ(), --- 405,416 ---- public static void rotateVerticallyEye(Camera c, double angle) { Vertex up = new Vertex(c.roll[0], c.roll[1], c.roll[2]); ! up.scaleIt(1 / up.length()); double x = c.center[0] - c.camera[0]; double y = c.center[1] - c.camera[1]; double z = c.center[2] - c.camera[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleIt(1 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleIt(1 / sidewards.length()); Geometry.rotate(angle, sidewards.getX(), sidewards.getY(), sidewards.getZ(), *************** *** 451,455 **** //forward.scale(1 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleInPlace(1 / sidewards.length()); Geometry.rotate(angle, sidewards.getX(), sidewards.getY(), sidewards.getZ(), --- 451,455 ---- //forward.scale(1 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleIt(1 / sidewards.length()); Geometry.rotate(angle, sidewards.getX(), sidewards.getY(), sidewards.getZ(), *************** *** 471,475 **** double z = c.center[2] - c.camera[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleInPlace(1 / forward.length()); Geometry.rotate(angle / 2, forward.getX(), forward.getY(), forward.getZ(), c.roll, new double[] {0, 0, 0}); --- 471,475 ---- double z = c.center[2] - c.camera[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleIt(1 / forward.length()); Geometry.rotate(angle / 2, forward.getX(), forward.getY(), forward.getZ(), c.roll, new double[] {0, 0, 0}); *************** *** 705,709 **** if (p1 != null && p2 != null) { modelCenter = p1.minus(p2); ! modelCenter.scaleInPlace(1.0 / 2.0); modelCenter = modelCenter.add(p2); it = vertices.iterator(); --- 705,709 ---- if (p1 != null && p2 != null) { modelCenter = p1.minus(p2); ! modelCenter.scaleIt(1.0 / 2.0); modelCenter = modelCenter.add(p2); it = vertices.iterator(); *************** *** 714,718 **** if (dist > radius) { radius = (dist + radius) / 2.0; ! dV.scaleInPlace((dist - radius) / dist); modelCenter = modelCenter.add(dV); } --- 714,718 ---- if (dist > radius) { radius = (dist + radius) / 2.0; ! dV.scaleIt((dist - radius) / dist); modelCenter = modelCenter.add(dV); } *************** *** 758,762 **** camera[1] - center[1], camera[2] - center[2]); ! cameraPos.scaleInPlace(cameraDistance / cameraPos.length()); cameraPos = cameraPos.add(modelCenter); setCenter(new double[] {modelCenter.getX(), --- 758,762 ---- camera[1] - center[1], camera[2] - center[2]); ! cameraPos.scaleIt(cameraDistance / cameraPos.length()); cameraPos = cameraPos.add(modelCenter); setCenter(new double[] {modelCenter.getX(), *************** *** 1001,1005 **** double[] center = current.getCenter(); Vertex back = new Vertex(camera).minus(new Vertex(center)); ! back.scaleInPlace(length / back.length()); camera[0] = center[0] + back.getX(); camera[1] = center[1] + back.getY(); --- 1001,1005 ---- double[] center = current.getCenter(); Vertex back = new Vertex(camera).minus(new Vertex(center)); ! back.scaleIt(length / back.length()); camera[0] = center[0] + back.getX(); camera[1] = center[1] + back.getY(); Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Plane.java 22 Nov 2007 10:12:49 -0000 1.34 --- Plane.java 11 Dec 2007 14:49:02 -0000 1.35 *************** *** 96,100 **** public Vertex normal() { Vertex normal = new Vertex(a, b, c); ! normal.scaleInPlace(1 / normal.length()); return normal; } --- 96,100 ---- public Vertex normal() { Vertex normal = new Vertex(a, b, c); ! normal.scaleIt(1 / normal.length()); return normal; } *************** *** 158,162 **** Vertex temp = alfa.cross(beta); Vertex norm = temp.cross(beta); ! norm.scaleInPlace(1 / norm.length()); Vertex intersec = intersection(rayIn); double a = norm.getX(); --- 158,162 ---- Vertex temp = alfa.cross(beta); Vertex norm = temp.cross(beta); ! norm.scaleIt(1 / norm.length()); Vertex intersec = intersection(rayIn); double a = norm.getX(); *************** *** 226,230 **** Vertex normal = normal(); double t = vector.dot(normal()); ! normal.scaleInPlace(t / normal.length()); vector = vector.minus(normal); return origin().add(vector); --- 226,230 ---- Vertex normal = normal(); double t = vector.dot(normal()); ! normal.scaleIt(t / normal.length()); vector = vector.minus(normal); return origin().add(vector); *************** *** 296,300 **** i.setY(i.getY() - n.getY() * t); i.setZ(i.getZ() - n.getZ() * t); ! i.scaleInPlace(1 / i.length()); j = n.cross(i); --- 296,300 ---- i.setY(i.getY() - n.getY() * t); i.setZ(i.getZ() - n.getZ() * t); ! i.scaleIt(1 / i.length()); j = n.cross(i); Index: SpaceAnalysis.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SpaceAnalysis.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SpaceAnalysis.java 13 Nov 2007 12:19:29 -0000 1.8 --- SpaceAnalysis.java 11 Dec 2007 14:49:02 -0000 1.9 *************** *** 125,129 **** Vertex i = leader.normal(); int direction = travel(leader, edge); ! n.scaleInPlace(direction); Surface selected = leader; double minimum = 2 * Math.PI; --- 125,129 ---- Vertex i = leader.normal(); int direction = travel(leader, edge); ! n.scaleIt(direction); Surface selected = leader; double minimum = 2 * Math.PI; *************** *** 133,137 **** Vertex normal = current.normal(); if (travel(current, edge) != direction) { ! normal.scaleInPlace(-1); } double t = i.dot(normal); --- 133,137 ---- Vertex normal = current.normal(); if (travel(current, edge) != direction) { ! normal.scaleIt(-1); } double t = i.dot(normal); Index: Direction.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Direction.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Direction.java 13 Nov 2007 12:19:29 -0000 1.16 --- Direction.java 11 Dec 2007 14:49:01 -0000 1.17 *************** *** 55,59 **** double slideScale; Vertex vunit = v.copy(); ! vunit.scaleInPlace(1 / v.length()); if (v.getX() != 0) { slideScale = v.getX() / (slideDir.dot(vunit) * vunit.getX()); --- 55,59 ---- double slideScale; Vertex vunit = v.copy(); ! vunit.scaleIt(1 / v.length()); if (v.getX() != 0) { slideScale = v.getX() / (slideDir.dot(vunit) * vunit.getX()); *************** *** 64,68 **** } direction = slideDir; ! direction.scaleInPlace(slideScale); } --- 64,68 ---- } direction = slideDir; ! direction.scaleIt(slideScale); } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.214 retrieving revision 1.215 diff -C2 -d -r1.214 -r1.215 *** Space.java 10 Dec 2007 13:31:11 -0000 1.214 --- Space.java 11 Dec 2007 14:49:02 -0000 1.215 *************** *** 1181,1185 **** average = average.add((Vertex)it.next()); } ! average.scaleInPlace(1.0 / (double)verts.size()); } return average; --- 1181,1185 ---- average = average.add((Vertex)it.next()); } ! average.scaleIt(1.0 / (double)verts.size()); } return average; *************** *** 1900,1906 **** Vertex spaceVector = s.normal(); if (s.getFrontDomain() == this) { ! spaceVector.scaleInPlace(1 / spaceVector.length()); } else if (s.getBackDomain() == this) { ! spaceVector.scaleInPlace(-1 / spaceVector.length()); } else { return false; --- 1900,1906 ---- Vertex spaceVector = s.normal(); if (s.getFrontDomain() == this) { ! spaceVector.scaleIt(1 / spaceVector.length()); } else if (s.getBackDomain() == this) { ! spaceVector.scaleIt(-1 / spaceVector.length()); } else { return false; *************** *** 1931,1935 **** //Building a coordinate system: Vertex n = sharedEdge.getDirection(); ! n.scaleInPlace(1 / n.length()); Vertex j = startSurface.normal(); --- 1931,1935 ---- //Building a coordinate system: Vertex n = sharedEdge.getDirection(); ! n.scaleIt(1 / n.length()); Vertex j = startSurface.normal(); *************** *** 1938,1944 **** } if (startSurface.getFrontDomain() == this) { ! j.scaleInPlace(1 / j.length()); } else { ! j.scaleInPlace(-1 / j.length()); } --- 1938,1944 ---- } if (startSurface.getFrontDomain() == this) { ! j.scaleIt(1 / j.length()); } else { ! j.scaleIt(-1 / j.length()); } *************** *** 1953,1957 **** n.getZ() * sharedVertex.getZ())); Vertex i = (p.project(sharedVertex)).minus(p.project(adjacentVertex)); ! i.scaleInPlace(1 / i.length()); CoordinateSystem cs = new CoordinateSystem(i, j , n, sharedVertex); --- 1953,1957 ---- n.getZ() * sharedVertex.getZ())); Vertex i = (p.project(sharedVertex)).minus(p.project(adjacentVertex)); ! i.scaleIt(1 / i.length()); CoordinateSystem cs = new CoordinateSystem(i, j , n, sharedVertex); *************** *** 1999,2003 **** Vertex projNotShared = coordinateSystem.projection(notShared); Vertex projEdgeDir = projNotShared.minus(projShared); ! projEdgeDir.scaleInPlace(1 / projEdgeDir.length()); Vertex xAxis = coordinateSystem.getI().copy(); double cosAngle = xAxis.dot(projEdgeDir); --- 1999,2003 ---- Vertex projNotShared = coordinateSystem.projection(notShared); Vertex projEdgeDir = projNotShared.minus(projShared); ! projEdgeDir.scaleIt(1 / projEdgeDir.length()); Vertex xAxis = coordinateSystem.getI().copy(); double cosAngle = xAxis.dot(projEdgeDir); Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Geometry.java 3 Dec 2007 15:01:37 -0000 1.66 --- Geometry.java 11 Dec 2007 14:49:01 -0000 1.67 *************** *** 122,128 **** double tetra = angle(projection); if (tetra > 0) { ! normal.scaleInPlace(-1); } ! normal.scaleInPlace(1 / normal.length()); return normal; } --- 122,128 ---- double tetra = angle(projection); if (tetra > 0) { ! normal.scaleIt(-1); } ! normal.scaleIt(1 / normal.length()); return normal; } *************** *** 222,226 **** double t = v.dot(normal); Vertex up = normal.copy(); ! up.scaleInPlace(t); projection.add(v.minus(up)); } --- 222,226 ---- double t = v.dot(normal); Vertex up = normal.copy(); ! up.scaleIt(t); projection.add(v.minus(up)); } Index: Line.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Line.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Line.java 13 Nov 2007 12:19:29 -0000 1.37 --- Line.java 11 Dec 2007 14:49:01 -0000 1.38 *************** *** 130,134 **** public Vertex getPointAt(double t) { Vertex tmp = direction.copy(); ! tmp.scaleInPlace(t); return getOrigin().add(tmp); } --- 130,134 ---- public Vertex getPointAt(double t) { Vertex tmp = direction.copy(); ! tmp.scaleIt(t); return getOrigin().add(tmp); } *************** *** 195,199 **** Vertex origin = getOrigin(); Vertex direction = getDirection().copy(); ! direction.scaleInPlace(length); Vertex from = origin.minus(direction); Vertex to = origin.add(direction); --- 195,199 ---- Vertex origin = getOrigin(); Vertex direction = getDirection().copy(); ! direction.scaleIt(length); Vertex from = origin.minus(direction); Vertex to = origin.add(direction); *************** *** 261,266 **** double s = ((v2 * w1 - v1 * w2) / denom); double t = ((u1 * w2 - u2 * w1) / -denom); ! d.scaleInPlace(-s); ! c.scaleInPlace(-t); Vertex inter1 = d.add(o); Vertex inter2 = c.add(p); --- 261,266 ---- double s = ((v2 * w1 - v1 * w2) / denom); double t = ((u1 * w2 - u2 * w1) / -denom); ! d.scaleIt(-s); ! c.scaleIt(-t); Vertex inter1 = d.add(o); Vertex inter2 = c.add(p); Index: EnergyCalc.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/EnergyCalc.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** EnergyCalc.java 13 Nov 2007 12:19:29 -0000 1.13 --- EnergyCalc.java 11 Dec 2007 14:49:01 -0000 1.14 *************** *** 94,98 **** Vertex normal = current.normal(); if (current.getBackDomain().isConstructionSpace()) { ! normal.scaleInPlace(-1); } Vertex origin = current.center(); --- 94,98 ---- Vertex normal = current.normal(); if (current.getBackDomain().isConstructionSpace()) { ! normal.scaleIt(-1); } Vertex origin = current.center(); Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** Vertex.java 5 Dec 2007 10:25:34 -0000 1.73 --- Vertex.java 11 Dec 2007 14:49:02 -0000 1.74 *************** *** 376,380 **** * @param scale The scale */ ! public void scaleInPlace(double scale) { setX(getX() * scale); setY(getY() * scale); --- 376,380 ---- * @param scale The scale */ ! public void scaleIt(double scale) { setX(getX() * scale); setY(getY() * scale); *************** *** 495,499 **** public void normalize() { if (getX() != 0.0 || getY() != 0.0 || getZ() != 0.0) { ! scaleInPlace(1 / length()); } } --- 495,499 ---- public void normalize() { if (getX() != 0.0 || getY() != 0.0 || getZ() != 0.0) { ! scaleIt(1 / length()); } } *************** *** 543,547 **** double scale = this.dot(onto) / onto.dot(onto); Vertex res = onto.copy(); ! res.scaleInPlace(scale); return res; } --- 543,547 ---- double scale = this.dot(onto) / onto.dot(onto); Vertex res = onto.copy(); ! res.scaleIt(scale); return res; } |
From: Michael L. <he...@us...> - 2007-12-11 14:49:08
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25364/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: renamed scaleInPlace to scaleIt Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.268 retrieving revision 1.269 diff -C2 -d -r1.268 -r1.269 *** View.java 7 Dec 2007 14:38:53 -0000 1.268 --- View.java 11 Dec 2007 14:49:11 -0000 1.269 *************** *** 1452,1456 **** if (!current.getStrippled()) { Vertex m = current.getFrom().add(current.getTo()); ! m.scaleInPlace(0.5); Vertex projected = transformation.project(m); double dx = x - projected.getX(); --- 1452,1456 ---- if (!current.getStrippled()) { Vertex m = current.getFrom().add(current.getTo()); ! m.scaleIt(0.5); Vertex projected = transformation.project(m); double dx = x - projected.getX(); *************** *** 1740,1744 **** ray = transformation.unProject(ray); rayDir = ray.getTo().minus(ray.getFrom()); ! normal.scaleInPlace(1 / normal.length()); return rayDir.dot(normal) < 0; } --- 1740,1744 ---- ray = transformation.unProject(ray); rayDir = ray.getTo().minus(ray.getFrom()); ! normal.scaleIt(1 / normal.length()); return rayDir.dot(normal) < 0; } |
From: Michael L. <he...@us...> - 2007-12-11 14:49:03
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24969/src/net/sourceforge/bprocessor/model/modellor Modified Files: InnerWallModellor.java ModelBathModellor2.java TileModellor.java WallPartingModellor.java Log Message: renamed scaleInPlace to scaleIt Index: TileModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/TileModellor.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** TileModellor.java 13 Nov 2007 12:19:30 -0000 1.23 --- TileModellor.java 11 Dec 2007 14:49:03 -0000 1.24 *************** *** 353,362 **** Collection<Vertex> createdVerts, Vertex increment) { ! increment.scaleInPlace(-1); do { slider.move(increment); } while (cs.translate(slider.getFrom()).getY() > minY && cs.translate(slider.getFrom()).getX() > minX); ! increment.scaleInPlace(-1); do { List<Vertex> intersections = new LinkedList<Vertex>(); --- 353,362 ---- Collection<Vertex> createdVerts, Vertex increment) { ! increment.scaleIt(-1); do { slider.move(increment); } while (cs.translate(slider.getFrom()).getY() > minY && cs.translate(slider.getFrom()).getX() > minX); ! increment.scaleIt(-1); do { List<Vertex> intersections = new LinkedList<Vertex>(); Index: WallPartingModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/WallPartingModellor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** WallPartingModellor.java 13 Nov 2007 12:19:30 -0000 1.5 --- WallPartingModellor.java 11 Dec 2007 14:49:03 -0000 1.6 *************** *** 95,102 **** Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleInPlace(wallThickness - 0.005); outerCopy.getFrom().move(delta.getX(), delta.getY(), delta.getZ()); delta.normalize(); ! delta.scaleInPlace(wallThickness); tileCopy.getFrom().move(delta.getX(), delta.getY(), delta.getZ()); fromInnerOffset = null; --- 95,102 ---- Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleIt(wallThickness - 0.005); outerCopy.getFrom().move(delta.getX(), delta.getY(), delta.getZ()); delta.normalize(); ! delta.scaleIt(wallThickness); tileCopy.getFrom().move(delta.getX(), delta.getY(), delta.getZ()); fromInnerOffset = null; *************** *** 104,113 **** Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleInPlace(wallThickness); tileCopy.getFrom().move(delta.getX(), delta.getY(), delta.getZ()); if (corner.equals("Split")) { fromInnerOffset = delta; fromInnerOffset.normalize(); ! fromInnerOffset.scaleInPlace(wallThickness - 0.005); } } --- 104,113 ---- Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleIt(wallThickness); tileCopy.getFrom().move(delta.getX(), delta.getY(), delta.getZ()); if (corner.equals("Split")) { fromInnerOffset = delta; fromInnerOffset.normalize(); ! fromInnerOffset.scaleIt(wallThickness - 0.005); } } *************** *** 123,131 **** Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleInPlace(-1); ! delta.scaleInPlace(wallThickness - 0.005); outerCopy.getTo().move(delta.getX(), delta.getY(), delta.getZ()); delta.normalize(); ! delta.scaleInPlace(wallThickness); tileCopy.getTo().move(delta.getX(), delta.getY(), delta.getZ()); toInnerOffset = null; --- 123,131 ---- Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleIt(-1); ! delta.scaleIt(wallThickness - 0.005); outerCopy.getTo().move(delta.getX(), delta.getY(), delta.getZ()); delta.normalize(); ! delta.scaleIt(wallThickness); tileCopy.getTo().move(delta.getX(), delta.getY(), delta.getZ()); toInnerOffset = null; *************** *** 133,143 **** Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleInPlace(-1); ! delta.scaleInPlace(wallThickness); tileCopy.getTo().move(delta.getX(), delta.getY(), delta.getZ()); if (corner.equals("Split")) { toInnerOffset = delta; toInnerOffset.normalize(); ! toInnerOffset.scaleInPlace(wallThickness - 0.005); } } --- 133,143 ---- Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleIt(-1); ! delta.scaleIt(wallThickness); tileCopy.getTo().move(delta.getX(), delta.getY(), delta.getZ()); if (corner.equals("Split")) { toInnerOffset = delta; toInnerOffset.normalize(); ! toInnerOffset.scaleIt(wallThickness - 0.005); } } *************** *** 157,161 **** dir.normalize(); Vertex usedDir = dir.copy(); ! usedDir.scaleInPlace(wallThickness - 0.005); inner.move(usedDir); Edge between1 = new Edge(outerCopy.getFrom(), inner.getFrom()); --- 157,161 ---- dir.normalize(); Vertex usedDir = dir.copy(); ! usedDir.scaleIt(wallThickness - 0.005); inner.move(usedDir); Edge between1 = new Edge(outerCopy.getFrom(), inner.getFrom()); *************** *** 172,180 **** //surface for tiles dir.normalize(); ! dir.scaleInPlace(wallThickness - 0.005); tileCopy.move(dir); Edge inner2 = tileCopy.copy(); dir.normalize(); ! dir.scaleInPlace(0.005); inner2.move(dir); between1 = new Edge(tileCopy.getFrom(), inner2.getFrom()); --- 172,180 ---- //surface for tiles dir.normalize(); ! dir.scaleIt(wallThickness - 0.005); tileCopy.move(dir); Edge inner2 = tileCopy.copy(); dir.normalize(); ! dir.scaleIt(0.005); inner2.move(dir); between1 = new Edge(tileCopy.getFrom(), inner2.getFrom()); Index: InnerWallModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/InnerWallModellor.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** InnerWallModellor.java 3 Dec 2007 09:10:59 -0000 1.13 --- InnerWallModellor.java 11 Dec 2007 14:49:03 -0000 1.14 *************** *** 228,232 **** if (vertical(e)) { dir.normalize(); ! dir.scaleInPlace(JOIST_WIDTH); o = e.getFrom(); o = o.add(dir); --- 228,232 ---- if (vertical(e)) { dir.normalize(); ! dir.scaleIt(JOIST_WIDTH); o = e.getFrom(); o = o.add(dir); *************** *** 274,278 **** Vertex j = cs.getJ().copy(); j.normalize(); ! j.scaleInPlace(SHEET_THICKNESS + JOIST_DEPTH); sheet2.move(j.getX(), j.getY(), j.getZ()); double correction = 1; --- 274,278 ---- Vertex j = cs.getJ().copy(); j.normalize(); ! j.scaleIt(SHEET_THICKNESS + JOIST_DEPTH); sheet2.move(j.getX(), j.getY(), j.getZ()); double correction = 1; *************** *** 375,379 **** j = surface.normal(); if (surface.getBackDomain() == space) { ! j.scaleInPlace(-1); } i = j.cross(n); --- 375,379 ---- j = surface.normal(); if (surface.getBackDomain() == space) { ! j.scaleIt(-1); } i = j.cross(n); *************** *** 385,389 **** Vertex topToBottom = vertical.otherVertex(origin).minus(origin); Vertex interval = horizontal.getDirection(); ! interval.scaleInPlace(joistInterval / interval.length()); Vertex current = origin.copy(); current.move(interval.getX(), interval.getY(), interval.getZ()); --- 385,389 ---- Vertex topToBottom = vertical.otherVertex(origin).minus(origin); Vertex interval = horizontal.getDirection(); ! interval.scaleIt(joistInterval / interval.length()); Vertex current = origin.copy(); current.move(interval.getX(), interval.getY(), interval.getZ()); Index: ModelBathModellor2.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/ModelBathModellor2.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ModelBathModellor2.java 29 Nov 2007 19:31:57 -0000 1.12 --- ModelBathModellor2.java 11 Dec 2007 14:49:03 -0000 1.13 *************** *** 224,231 **** Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleInPlace(wallThickness - 0.005); outerCopy.getFrom().move(delta.getX(), delta.getY(), delta.getZ()); delta.normalize(); ! delta.scaleInPlace(wallThickness); tileCopy.getFrom().move(delta.getX(), delta.getY(), delta.getZ()); fromInnerOffset = null; --- 224,231 ---- Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleIt(wallThickness - 0.005); outerCopy.getFrom().move(delta.getX(), delta.getY(), delta.getZ()); delta.normalize(); ! delta.scaleIt(wallThickness); tileCopy.getFrom().move(delta.getX(), delta.getY(), delta.getZ()); fromInnerOffset = null; *************** *** 233,242 **** Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleInPlace(wallThickness); tileCopy.getFrom().move(delta.getX(), delta.getY(), delta.getZ()); if (corner.equals("Split")) { fromInnerOffset = delta; fromInnerOffset.normalize(); ! fromInnerOffset.scaleInPlace(wallThickness - 0.005); } } --- 233,242 ---- Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleIt(wallThickness); tileCopy.getFrom().move(delta.getX(), delta.getY(), delta.getZ()); if (corner.equals("Split")) { fromInnerOffset = delta; fromInnerOffset.normalize(); ! fromInnerOffset.scaleIt(wallThickness - 0.005); } } *************** *** 252,260 **** Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleInPlace(-1); ! delta.scaleInPlace(wallThickness - 0.005); outerCopy.getTo().move(delta.getX(), delta.getY(), delta.getZ()); delta.normalize(); ! delta.scaleInPlace(wallThickness); tileCopy.getTo().move(delta.getX(), delta.getY(), delta.getZ()); toInnerOffset = null; --- 252,260 ---- Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleIt(-1); ! delta.scaleIt(wallThickness - 0.005); outerCopy.getTo().move(delta.getX(), delta.getY(), delta.getZ()); delta.normalize(); ! delta.scaleIt(wallThickness); tileCopy.getTo().move(delta.getX(), delta.getY(), delta.getZ()); toInnerOffset = null; *************** *** 262,272 **** Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleInPlace(-1); ! delta.scaleInPlace(wallThickness); tileCopy.getTo().move(delta.getX(), delta.getY(), delta.getZ()); if (corner.equals("Split")) { toInnerOffset = delta; toInnerOffset.normalize(); ! toInnerOffset.scaleInPlace(wallThickness - 0.005); } } --- 262,272 ---- Vertex delta = outer.getDirection(); delta.normalize(); ! delta.scaleIt(-1); ! delta.scaleIt(wallThickness); tileCopy.getTo().move(delta.getX(), delta.getY(), delta.getZ()); if (corner.equals("Split")) { toInnerOffset = delta; toInnerOffset.normalize(); ! toInnerOffset.scaleIt(wallThickness - 0.005); } } *************** *** 286,290 **** dir.normalize(); Vertex usedDir = dir.copy(); ! usedDir.scaleInPlace(wallThickness - 0.005); inner.move(usedDir); Edge between1 = new Edge(outerCopy.getFrom(), inner.getFrom()); --- 286,290 ---- dir.normalize(); Vertex usedDir = dir.copy(); ! usedDir.scaleIt(wallThickness - 0.005); inner.move(usedDir); Edge between1 = new Edge(outerCopy.getFrom(), inner.getFrom()); *************** *** 301,309 **** //surface for tiles dir.normalize(); ! dir.scaleInPlace(wallThickness - 0.005); tileCopy.move(dir); Edge inner2 = tileCopy.copy(); dir.normalize(); ! dir.scaleInPlace(0.005); inner2.move(dir); between1 = new Edge(tileCopy.getFrom(), inner2.getFrom()); --- 301,309 ---- //surface for tiles dir.normalize(); ! dir.scaleIt(wallThickness - 0.005); tileCopy.move(dir); Edge inner2 = tileCopy.copy(); dir.normalize(); ! dir.scaleIt(0.005); inner2.move(dir); between1 = new Edge(tileCopy.getFrom(), inner2.getFrom()); *************** *** 547,551 **** Vertex orthoDir = alongE.cross(cross); Vertex deltaUnit = orthoDir.copy(); ! orthoDir.scaleInPlace(wallThickness); double slideScale = 0; if (deltaUnit.getX() != 0) { --- 547,551 ---- Vertex orthoDir = alongE.cross(cross); Vertex deltaUnit = orthoDir.copy(); ! orthoDir.scaleIt(wallThickness); double slideScale = 0; if (deltaUnit.getX() != 0) { *************** *** 557,561 **** slideScale = orthoDir.getZ() / (direction.dot(deltaUnit) * deltaUnit.getZ()); } ! direction.scaleInPlace(slideScale); //Create other edge and connections Edge moved = copy.copy(); --- 557,561 ---- slideScale = orthoDir.getZ() / (direction.dot(deltaUnit) * deltaUnit.getZ()); } ! direction.scaleIt(slideScale); //Create other edge and connections Edge moved = copy.copy(); |
From: Michael L. <he...@us...> - 2007-12-11 14:49:03
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/constraints In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24969/src/net/sourceforge/bprocessor/model/constraints Modified Files: OffsetConstraint.java Log Message: renamed scaleInPlace to scaleIt Index: OffsetConstraint.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/constraints/OffsetConstraint.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** OffsetConstraint.java 13 Nov 2007 12:19:30 -0000 1.8 --- OffsetConstraint.java 11 Dec 2007 14:49:04 -0000 1.9 *************** *** 135,139 **** Vertex origin = system.getOrigin(); Vertex n = system.getN(); ! n.scaleInPlace(1 / n.length()); Vertex v = slave.getFirstVertex(); Vertex u = v.minus(origin); --- 135,139 ---- Vertex origin = system.getOrigin(); Vertex n = system.getN(); ! n.scaleIt(1 / n.length()); Vertex v = slave.getFirstVertex(); Vertex u = v.minus(origin); *************** *** 150,154 **** CoordinateSystem system = master.coordinateSystem(); Vertex n = system.getN(); ! n.scaleInPlace(1 / n.length()); Set vertices = new HashSet(); --- 150,154 ---- CoordinateSystem system = master.coordinateSystem(); Vertex n = system.getN(); ! n.scaleIt(1 / n.length()); Set vertices = new HashSet(); |
From: Michael L. <he...@us...> - 2007-12-11 14:48:43
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24958/src/net/sourceforge/bprocessor/facade/modellor Modified Files: NetFacadeModellor.java FacadeModellor.java Log Message: renamed scaleInPlace to scaleIt Index: NetFacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/NetFacadeModellor.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** NetFacadeModellor.java 13 Nov 2007 12:21:46 -0000 1.42 --- NetFacadeModellor.java 11 Dec 2007 14:48:47 -0000 1.43 *************** *** 421,425 **** Vertex out = front.normal(); if (front.getBackDomain() == space) { ! out.scaleInPlace(-1); } Set<Surface> frame1 = generateFrame(cut1, field.getEdges(), out); --- 421,425 ---- Vertex out = front.normal(); if (front.getBackDomain() == space) { ! out.scaleIt(-1); } Set<Surface> frame1 = generateFrame(cut1, field.getEdges(), out); *************** *** 821,825 **** angleV = local.unTranslate(angleV); Plane plane = new Plane(angleV.getX(), angleV.getY(), angleV.getZ(), shared); ! j.scaleInPlace(-1); Collection<Surface> extrusion = Edge.extrude(cutEdges, j, plane); return extrusion; --- 821,825 ---- angleV = local.unTranslate(angleV); Plane plane = new Plane(angleV.getX(), angleV.getY(), angleV.getZ(), shared); ! j.scaleIt(-1); Collection<Surface> extrusion = Edge.extrude(cutEdges, j, plane); return extrusion; Index: FacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/FacadeModellor.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** FacadeModellor.java 13 Nov 2007 12:21:46 -0000 1.37 --- FacadeModellor.java 11 Dec 2007 14:48:47 -0000 1.38 *************** *** 439,443 **** offset = horDir.copy(); for (int i = 0; i < vertPosts; i++) { ! offset.scaleInPlace(lengthV / offset.length()); Constructor l = new Line(cross.add(offset), vertDir.copy(), true, true); lengthV += intervalV; --- 439,443 ---- offset = horDir.copy(); for (int i = 0; i < vertPosts; i++) { ! offset.scaleIt(lengthV / offset.length()); Constructor l = new Line(cross.add(offset), vertDir.copy(), true, true); lengthV += intervalV; *************** *** 450,454 **** offset = vertDir.copy(); for (int i = 0; i < horPosts; i++) { ! offset.scaleInPlace(lengthH / offset.length()); Line l = new Line(cross.add(offset), horDir.copy(), true, true); lengthH += (intervalH); --- 450,454 ---- offset = vertDir.copy(); for (int i = 0; i < horPosts; i++) { ! offset.scaleIt(lengthH / offset.length()); Line l = new Line(cross.add(offset), horDir.copy(), true, true); lengthH += (intervalH); |
From: Michael L. <he...@us...> - 2007-12-11 14:34:04
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19493/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Log Message: Better approximation of BoundingSphere Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** Camera.java 11 Dec 2007 13:24:44 -0000 1.48 --- Camera.java 11 Dec 2007 14:34:07 -0000 1.49 *************** *** 583,591 **** /** ! * Computes a crude approximation of boundinsphere in linear time * @param vertices collection of vertices * @return bounding sphere */ public static BoundingSphere from(Collection<Vertex> vertices) { BoundingBox box = BoundingBox.from(vertices); Vertex v1 = box.min; --- 583,663 ---- /** ! * Computes an approximation of boundinsphere in linear time ! * Algorithm by Jack Ritter in "Graphics Gems" * @param vertices collection of vertices * @return bounding sphere */ public static BoundingSphere from(Collection<Vertex> vertices) { + Vertex xmin = new Vertex(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE); + Vertex xmax = new Vertex(-10000, -10000, -10000); + Vertex ymin = xmin; + Vertex ymax = xmax; + Vertex zmin = xmin; + Vertex zmax = xmax; + + for (Vertex current : vertices) { + if (current.x < xmin.x) { + xmin = current; + } + if (current.x > xmax.x) { + xmax = current; + } + if (current.y < ymin.y) { + ymin = current; + } + if (current.y > ymax.y) { + ymax = current; + } + if (current.z < zmin.z) { + zmin = current; + } + if (current.z > zmax.z) { + zmax = current; + } + } + Vertex xspan = xmax.minus(xmin); + Vertex yspan = ymax.minus(ymin); + Vertex zspan = zmax.minus(zmin); + + + double dia = xspan.length(); + Vertex v1 = xmin; + Vertex v2 = xmax; + + if (yspan.length() > dia) { + dia = yspan.length(); + v1 = ymin; + v2 = ymax; + } + if (zspan.length() > dia) { + dia = zspan.length(); + v1 = zmin; + v2 = zmax; + } + + Vertex center = v1.add(v2).scale(0.5); + double radius = 0.1; + + for (Vertex current : vertices) { + Vertex d = current.minus(center); + double length = d.length(); + if (length > radius) { + radius = (radius + length) / 2; + double diff = length - radius; + center = center.add(d.scale(diff / length)); + } + } + if (radius < 0.00001) { + radius = 0.5; + } + return new BoundingSphere(center, radius); + } + + /** + * Computes a crude approximation of boundinsphere in linear time + * @param vertices collection of vertices + * @return bounding sphere + */ + public static BoundingSphere from1(Collection<Vertex> vertices) { BoundingBox box = BoundingBox.from(vertices); Vertex v1 = box.min; *************** *** 607,611 **** /** ! * Computes a better approximation of boundinsphere in quadratic time * @param vertices collection of vertices * @return bounding sphere --- 679,683 ---- /** ! * Computes an approximation of boundinsphere in quadratic time * @param vertices collection of vertices * @return bounding sphere |
From: Michael L. <he...@us...> - 2007-12-11 13:24:47
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24571/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Log Message: faster but not very good zoomOn function Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** Camera.java 13 Nov 2007 12:19:29 -0000 1.47 --- Camera.java 11 Dec 2007 13:24:44 -0000 1.48 *************** *** 477,510 **** /** ! * Moves the camera to a position where the entire model is visible. ! * @param aspect the acspect ratio of the view. ! * @param c the Collection of object to zoom on to. */ ! public void zoomOn(Collection<? extends Geometric> c, double aspect) { ! Set<Vertex> allVertices = new HashSet<Vertex>(); ! for (Geometric g : c) { ! if (g instanceof Space) { ! Space s = (Space)g; ! if (s.getEnvelope().isEmpty()) { ! if (s.getVertices().isEmpty()) { ! g.collect(); ! } else { ! allVertices.addAll(s.getVertices()); ! } ! } else { ! allVertices.addAll(Geometry.collect(s.getEnvelope())); } - } else { - allVertices.addAll(g.collect()); } } ! ! if (!allVertices.isEmpty()) { ! //Computing center and radius of the minimal bounding sphere ! Set<Vertex> notTested = new HashSet<Vertex>(allVertices); double radius = 0; Vertex p1 = null; Vertex p2 = null; ! Iterator it = allVertices.iterator(); while (it.hasNext()) { Vertex v = (Vertex) it.next(); --- 477,621 ---- /** ! * Represents a bounding box ! * */ ! private static class BoundingBox { ! private Vertex min; ! private Vertex max; ! ! /** ! * Constructs the bounding box ! * @param min minimum ! * @param max maximum ! */ ! public BoundingBox(Vertex min, Vertex max) { ! this.min = min; ! this.max = max; ! } ! ! /** ! * Returns minimum ! * @return minimum ! */ ! public Vertex min() { ! return min; ! } ! ! /** ! * Returns maximum ! * @return maximum ! */ ! public Vertex max() { ! return max; ! } ! ! /** ! * Computes bounding box ! * @param vertices collection of vertices ! * @return bounding box ! */ ! public static BoundingBox from(Collection<Vertex> vertices) { ! double xmin = Double.MAX_VALUE; ! double xmax = Double.MIN_VALUE; ! double ymin = Double.MAX_VALUE; ! double ymax = Double.MIN_VALUE; ! double zmin = Double.MAX_VALUE; ! double zmax = Double.MIN_VALUE; ! for (Vertex current : vertices) { ! if (current.getX() < xmin) { ! xmin = current.getX(); ! } ! if (current.getX() > xmax) { ! xmax = current.getX(); ! } ! if (current.getY() < ymin) { ! ymin = current.getY(); ! } ! if (current.getY() > ymax) { ! ymax = current.getY(); ! } ! if (current.getZ() < zmin) { ! zmin = current.getZ(); ! } ! if (current.getZ() > zmax) { ! zmax = current.getZ(); } } + Vertex min = new Vertex(xmin, ymin, zmin); + Vertex max = new Vertex(xmax, ymax, zmax); + return new BoundingBox(min, max); } ! } ! ! /** ! * Represents a bounding sphere ! * ! */ ! private static class BoundingSphere { ! private Vertex center; ! private double radius; ! ! /** ! * Constructs a bounding sphere ! * @param center center ! * @param radius radius ! */ ! public BoundingSphere(Vertex center, double radius) { ! this.center = center; ! this.radius = radius; ! } ! ! /** ! * Returns center ! * @return center ! */ ! public Vertex center() { ! return center; ! } ! ! /** ! * Returns radius ! * @return radius ! */ ! public double radius() { ! return radius; ! } ! ! /** ! * Computes a crude approximation of boundinsphere in linear time ! * @param vertices collection of vertices ! * @return bounding sphere ! */ ! public static BoundingSphere from(Collection<Vertex> vertices) { ! BoundingBox box = BoundingBox.from(vertices); ! Vertex v1 = box.min; ! Vertex v2 = box.max; ! Vertex center = v1.add(v2).scale(0.5); ! double radius = 0.0; ! for (Vertex current : vertices) { ! Vertex d = current.minus(center); ! if (d.length() > radius) { ! radius = d.length(); ! } ! } ! if (radius < 0.00001) { ! radius = 0.5; ! } ! return new BoundingSphere(center, radius); ! } ! ! ! /** ! * Computes a better approximation of boundinsphere in quadratic time ! * @param vertices collection of vertices ! * @return bounding sphere ! */ ! public static BoundingSphere from0(Collection<Vertex> vertices) { ! Set<Vertex> notTested = new HashSet<Vertex>(vertices); double radius = 0; + Vertex modelCenter = new Vertex(0, 0, 0); Vertex p1 = null; Vertex p2 = null; ! Iterator it = vertices.iterator(); while (it.hasNext()) { Vertex v = (Vertex) it.next(); *************** *** 521,534 **** } if (p1 != null && p2 != null) { ! Vertex modelCenter = p1.minus(p2); modelCenter.scaleInPlace(1.0 / 2.0); modelCenter = modelCenter.add(p2); ! //expand sphere if needs ! it = allVertices.iterator(); while (it.hasNext()) { Vertex v = (Vertex)it.next(); Vertex dV = v.minus(modelCenter); double dist = dV.length(); - //if v is outside the sphere expand it to contain v. if (dist > radius) { radius = (dist + radius) / 2.0; --- 632,643 ---- } if (p1 != null && p2 != null) { ! modelCenter = p1.minus(p2); modelCenter.scaleInPlace(1.0 / 2.0); modelCenter = modelCenter.add(p2); ! it = vertices.iterator(); while (it.hasNext()) { Vertex v = (Vertex)it.next(); Vertex dV = v.minus(modelCenter); double dist = dV.length(); if (dist > radius) { radius = (dist + radius) / 2.0; *************** *** 537,559 **** } } - - //Setting up camera - double halfFocal = this.getFocalwidth() / 2.0; - double halfFocalVerTan = Math.tan(Math.toRadians(halfFocal)); - double halfFocalHorTan = halfFocalVerTan * aspect; - double width = Math.min(halfFocalHorTan, halfFocalVerTan); - double cameraDistance = radius / width; - Vertex cameraPos = new Vertex(camera[0] - center[0], - camera[1] - center[1], - camera[2] - center[2]); - cameraPos.scaleInPlace(cameraDistance / cameraPos.length()); - cameraPos = cameraPos.add(modelCenter); - setCenter(new double[] {modelCenter.getX(), - modelCenter.getY(), - modelCenter.getZ()}); - setCamera(new double[] {cameraPos.getX(), - cameraPos.getY(), - cameraPos.getZ()}); } } } --- 646,697 ---- } } } + return new BoundingSphere(modelCenter, radius); + } + } + + /** + * Moves the camera to a position where the entire model is visible. + * @param aspect the acspect ratio of the view. + * @param c the Collection of object to zoom on to. + */ + public void zoomOn(Collection<? extends Geometric> c, double aspect) { + Set<Vertex> allVertices = new HashSet<Vertex>(); + for (Geometric g : c) { + if (g instanceof Space) { + Space s = (Space)g; + if (s.getEnvelope().isEmpty()) { + allVertices.addAll(s.collectInterior()); + } else { + allVertices.addAll(Geometry.collect(s.getEnvelope())); + } + } else { + allVertices.addAll(g.collect()); + } + } + + if (!allVertices.isEmpty()) { + + BoundingSphere sphere = BoundingSphere.from(allVertices); + double radius = sphere.radius; + Vertex modelCenter = sphere.center; + + //Setting up camera + double halfFocal = this.getFocalwidth() / 2.0; + double halfFocalVerTan = Math.tan(Math.toRadians(halfFocal)); + double halfFocalHorTan = halfFocalVerTan * aspect; + double width = Math.min(halfFocalHorTan, halfFocalVerTan); + double cameraDistance = radius / width; + Vertex cameraPos = new Vertex(camera[0] - center[0], + camera[1] - center[1], + camera[2] - center[2]); + cameraPos.scaleInPlace(cameraDistance / cameraPos.length()); + cameraPos = cameraPos.add(modelCenter); + setCenter(new double[] {modelCenter.getX(), + modelCenter.getY(), + modelCenter.getZ()}); + setCamera(new double[] {cameraPos.getX(), + cameraPos.getY(), + cameraPos.getZ()}); } } |
From: Michael L. <he...@us...> - 2007-12-10 23:10:09
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16854/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: experiment with display of envelope in treeview Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -d -r1.130 -r1.131 *** GenericTreeView.java 10 Dec 2007 18:45:06 -0000 1.130 --- GenericTreeView.java 10 Dec 2007 23:10:08 -0000 1.131 *************** *** 450,453 **** --- 450,461 ---- /** + * + * @param label Object + */ + public ContainerNode(Object label) { + super(label); + } + + /** * Constructor for ContainerNode * @param content User collection to put in *************** *** 459,462 **** --- 467,471 ---- this.content = content; this.sort = sort; + insertChildren(content); } *************** *** 637,644 **** private void makeContainerContent(Space space) { Set surfaces = space.getEnvelope(); ! add(new SurfaceContainer("Envelope", surfaces, false)); String lvlstr = Space.levelToString(space.getLevel() + 1); add(new ElementContainer(lvlstr + "s", space.getElements())); ! add(new GeometryNode("Geometry", space)); ContainerNode cn = new ConstructorContainer("Constructors", space.getConstructors()); add(cn); --- 646,655 ---- private void makeContainerContent(Space space) { Set surfaces = space.getEnvelope(); ! add(new EnvelopeContainer("Envelope", space)); String lvlstr = Space.levelToString(space.getLevel() + 1); add(new ElementContainer(lvlstr + "s", space.getElements())); ! if (Project.doDisplayGeometry()) { ! add(new GeometryNode("Geometry", space)); ! } ContainerNode cn = new ConstructorContainer("Constructors", space.getConstructors()); add(cn); *************** *** 683,691 **** Space space = (Space)userObject; if (space.isContainer()) { ! ((GenericNode)getChildAt(0)).update(s.getEnvelope()); ! ((GenericNode)getChildAt(1)).update(s.getElements()); ! ((GenericNode)getChildAt(2)).update(s); ! ((GenericNode)getChildAt(3)).update(s.getConstructors()); ! int placement = 4; if (s.getModellor() != null) { if (getChildCount() >= placement + 1) { --- 694,705 ---- Space space = (Space)userObject; if (space.isContainer()) { ! int inx = 0; ! ((GenericNode)getChildAt(inx++)).update(s.getEnvelope()); ! ((GenericNode)getChildAt(inx++)).update(s.getElements()); ! if (Project.doDisplayGeometry()) { ! ((GenericNode)getChildAt(inx++)).update(s); ! } ! ((GenericNode)getChildAt(inx++)).update(s.getConstructors()); ! int placement = inx; if (s.getModellor() != null) { if (getChildCount() >= placement + 1) { *************** *** 783,786 **** --- 797,838 ---- /** + * SurfaceNode + */ + public class EnvelopeNode extends EntityNode { + private Space space; + + /** + * Constructor for SurfaceNode + * @param surface The surface + * @param space Space + */ + public EnvelopeNode(Surface surface, Space space) { + super(surface); + this.space = space; + } + + /** + * {@inheritDoc} + */ + public String toString() { + Surface surface = (Surface) userObject; + Space other; + if (surface.getBackDomain() == space) { + other = surface.getFrontDomain(); + } else { + other = surface.getBackDomain(); + } + return surface.getName() + ": " + other.getDisplayName(); + } + + /** + * {@inheritDoc} + */ + public ImageIcon icon() { + return surfaceicon; + } + } + + /** * ConstructorNode */ *************** *** 900,904 **** public SurfaceContainer(String name, Collection surfaces, boolean sort) { super(name, surfaces, sort); - insertChildren(surfaces); } --- 952,955 ---- *************** *** 918,921 **** --- 969,1003 ---- /** + * SurfaceContainer + */ + public class EnvelopeContainer extends ContainerNode { + private Space space; + /** + * Constructor for SurfaceContainer + * @param name The name + * @param space Space + */ + public EnvelopeContainer(String name, Space space) { + super(name); + this.space = space; + this.content = space.getEnvelope(); + insertChildren(content); + } + + /** {@inheritDoc} */ + public EntityNode nodeFor(Object entity) { + return new EnvelopeNode((Surface) entity, space); + } + + /** + * Return icon + * @return Icon + */ + public ImageIcon icon() { + return surfacegroupicon; + } + } + + /** * ElementContainer */ *************** *** 928,932 **** public ElementContainer(String name, Collection elements) { super(name, elements, true); - insertChildren(elements); } --- 1010,1013 ---- *************** *** 991,995 **** public MaterialContainer(Object label, Collection<Material> object, boolean sort) { super(label, object, sort); - insertChildren(object); } --- 1072,1075 ---- *************** *** 1005,1009 **** /** {@inheritDoc} */ public EntityNode nodeFor(Object entity) { ! return new EntityNode((Material) entity); } --- 1085,1089 ---- /** {@inheritDoc} */ public EntityNode nodeFor(Object entity) { ! return new EntityNode(entity); } *************** *** 1040,1044 **** public ConstructorContainer(String name, Collection<Constructor> constructors) { super(name, constructors, true); - insertChildren(constructors); } --- 1120,1123 ---- *************** *** 1069,1073 **** public EdgeContainer(String name, Collection<Edge> edges, boolean sort) { super(name, edges, sort); - insertChildren(edges); } --- 1148,1151 ---- *************** *** 1096,1100 **** public ProjectNode(Project p) { super(p, p.getSpaces(), true); - insertChildren(p.getSpaces()); } --- 1174,1177 ---- *************** *** 1133,1137 **** public ComponentContainer(String name, Collection<Component> content) { super(name, content, false); - insertChildren(content); } --- 1210,1213 ---- *************** *** 1208,1212 **** public CameraNode(Camera c) { super(c, c.getClipplanes(), true); - insertChildren(c.getClipplanes()); } --- 1284,1287 ---- *************** *** 1236,1240 **** public VertexContainer(String name, Collection vertices, boolean sort) { super(name, vertices, sort); - insertChildren(vertices); } --- 1311,1314 ---- *************** *** 1264,1268 **** public ParameterBlockNode(String name, ParameterBlock object) { super(name, object.getAttributes(), true); - insertChildren(object.getAttributes()); } --- 1338,1341 ---- *************** *** 1325,1329 **** public ConstraintContainer(String name, Collection constraints) { super(name, constraints, true); - insertChildren(constraints); } } --- 1398,1401 ---- *************** *** 1340,1344 **** public RelationContainer(List<Relation> relations) { super("Relations", relations, true); - insertChildren(relations); } } --- 1412,1415 ---- |
From: Michael L. <he...@us...> - 2007-12-10 23:10:02
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16587/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: experiment with display of envelope in treeview Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.147 retrieving revision 1.148 diff -C2 -d -r1.147 -r1.148 *** Project.java 9 Dec 2007 08:26:38 -0000 1.147 --- Project.java 10 Dec 2007 23:10:04 -0000 1.148 *************** *** 62,65 **** --- 62,68 ---- private static Collection<Component> library; + + private static boolean doDisplayGeometry; + private static boolean doDebugGeometry; /** The cameras */ *************** *** 121,124 **** --- 124,144 ---- /** + * + * @return boolean + */ + public static boolean doDisplayGeometry() { + return Project.doDisplayGeometry; + } + + /** + * + * @return boolean + */ + public static boolean doDebugGeometry() { + return Project.doDebugGeometry; + } + + + /** * Get the instance * @return The instance *************** *** 804,808 **** setName((String)a.getValue()); } else if (a.getName().equals("Script")) { ! script = new Description(((String)a.getValue().toString())); } } --- 824,832 ---- setName((String)a.getValue()); } else if (a.getName().equals("Script")) { ! script = new Description(a.getValue().toString()); ! } else if (a.getName().equals("Display Geometry")) { ! doDisplayGeometry = ((Boolean) a.getValue()).booleanValue(); ! } else if (a.getName().equals("Debug Geometry")) { ! doDebugGeometry = ((Boolean) a.getValue()).booleanValue(); } } *************** *** 817,826 **** ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Name", getName())); - //res.add(new Attribute("Energyloss", new Double(EnergyCalc.energyLoss()), false)); res.add(new Attribute("Heated area", new Double(EnergyCalc.heatedArea()), false)); ! /*if (EnergyCalc.heatedArea() != 0) { ! res.add(new Attribute("loss per m2", ! new Double(EnergyCalc.energyLoss() / EnergyCalc.heatedArea()), false)); ! }*/ res.add(new Attribute("Script", script)); return res; --- 841,847 ---- ArrayList<Attribute> res = new ArrayList<Attribute>(); res.add(new Attribute("Name", getName())); res.add(new Attribute("Heated area", new Double(EnergyCalc.heatedArea()), false)); ! res.add(new Attribute("Display Geometry", Boolean.valueOf(doDisplayGeometry))); ! res.add(new Attribute("Debug Geometry", Boolean.valueOf(doDebugGeometry))); res.add(new Attribute("Script", script)); return res; |
From: Michael L. <he...@us...> - 2007-12-10 18:45:05
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10171/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java SpaceTreeView.java Log Message: Cleanup Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** GenericTreeView.java 10 Dec 2007 13:47:34 -0000 1.129 --- GenericTreeView.java 10 Dec 2007 18:45:06 -0000 1.130 *************** *** 18,27 **** import java.util.Enumeration; import java.util.HashSet; - import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Set; - import java.util.Stack; - import java.awt.event.ActionEvent; --- 18,24 ---- *************** *** 454,469 **** /** * Constructor for ContainerNode ! * @param object User collection to put in * @param label The label for the container node * @param sort Sort the children? */ ! public ContainerNode(Object label, Collection< ? extends Entity> object, boolean sort) { super(label); ! this.content = object; this.sort = sort; } /** ! * @return Display String */ public String toString() { --- 451,466 ---- /** * Constructor for ContainerNode ! * @param content User collection to put in * @param label The label for the container node * @param sort Sort the children? */ ! public ContainerNode(Object label, Collection< ? extends Entity> content, boolean sort) { super(label); ! this.content = content; this.sort = sort; } /** ! * {@inheritDoc} */ public String toString() { *************** *** 474,480 **** } } /** ! * Always not be leaf ! * @return answer */ public boolean isLeaf() { --- 471,477 ---- } } + /** ! * {@inheritDoc} */ public boolean isLeaf() { *************** *** 483,488 **** /** ! * Return icon ! * @return Icon */ public ImageIcon icon() { --- 480,484 ---- /** ! * {@inheritDoc} */ public ImageIcon icon() { *************** *** 519,546 **** */ public void update(Object object) { ! if (object instanceof Collection) { ! content = (Collection) object; ! Set<Entity> elements = new HashSet<Entity>(); ! elements.addAll(content); ! Set<GenericNode> children = new HashSet<GenericNode>(); ! Enumeration enumeration = this.children(); ! while (enumeration.hasMoreElements()) { ! GenericNode node = (GenericNode)enumeration.nextElement(); ! Entity entity = (Entity)node.getUserObject(); ! if (elements.contains(entity)) { ! node.update(entity); ! elements.remove(entity); ! } else { ! children.add(node); ! } ! } ! if (elements.size() > 0) { ! this.insertChildren(elements); ! } ! if (children.size() > 0) { ! this.removeChildren(children); } ! } else { ! log.warn(userObject + " were called with " + object + " and not a collection"); } } --- 515,538 ---- */ public void update(Object object) { ! content = (Collection) object; ! Set<Entity> elements = new HashSet<Entity>(); ! elements.addAll(content); ! Set<GenericNode> children = new HashSet<GenericNode>(); ! Enumeration enumeration = this.children(); ! while (enumeration.hasMoreElements()) { ! GenericNode node = (GenericNode)enumeration.nextElement(); ! Entity entity = (Entity)node.getUserObject(); ! if (elements.contains(entity)) { ! node.update(entity); ! elements.remove(entity); ! } else { ! children.add(node); } ! } ! if (elements.size() > 0) { ! this.insertChildren(elements); ! } ! if (children.size() > 0) { ! this.removeChildren(children); } } *************** *** 558,566 **** int i = 0; for (Entity current : sorted) { - if (current == null) { - log.error("There is a consistency problem cause " + getUserObject() + - " hold null objects"); - continue; - } this.add(nodeFor(current)); ins[i] = this.getChildCount() - 1; --- 550,553 ---- *************** *** 640,644 **** } else { Set surfaces = space.getEnvelope(); ! add(new SurfaceContainer("Envelope", surfaces)); } } --- 627,631 ---- } else { Set surfaces = space.getEnvelope(); ! add(new SurfaceContainer("Envelope", surfaces, false)); } } *************** *** 650,657 **** private void makeContainerContent(Space space) { Set surfaces = space.getEnvelope(); ! add(new SurfaceContainer("Envelope", surfaces)); String lvlstr = Space.levelToString(space.getLevel() + 1); add(new ElementContainer(lvlstr + "s", space.getElements())); ! add(new GeometryContainer("Geometry", space)); ContainerNode cn = new ConstructorContainer("Constructors", space.getConstructors()); add(cn); --- 637,644 ---- private void makeContainerContent(Space space) { Set surfaces = space.getEnvelope(); ! add(new SurfaceContainer("Envelope", surfaces, false)); String lvlstr = Space.levelToString(space.getLevel() + 1); add(new ElementContainer(lvlstr + "s", space.getElements())); ! add(new GeometryNode("Geometry", space)); ContainerNode cn = new ConstructorContainer("Constructors", space.getConstructors()); add(cn); *************** *** 667,671 **** private void makeInstanceContent(Space space) { Set surfaces = space.getEnvelope(); ! add(new SurfaceContainer("Envelope", surfaces)); SpaceNode proto = new SpaceNode(space.getProto()); add(proto); --- 654,658 ---- private void makeInstanceContent(Space space) { Set surfaces = space.getEnvelope(); ! add(new SurfaceContainer("Envelope", surfaces, false)); SpaceNode proto = new SpaceNode(space.getProto()); add(proto); *************** *** 725,729 **** } else { removeAllChildren(); ! add(new SurfaceContainer("Surfaces", s.getEnvelope())); model.nodeStructureChanged(this); } --- 712,716 ---- } else { removeAllChildren(); ! add(new SurfaceContainer("Envelope", s.getEnvelope(), false)); model.nodeStructureChanged(this); } *************** *** 909,915 **** * @param name The name * @param surfaces The surfaces */ ! public SurfaceContainer(String name, Collection surfaces) { ! super(name, surfaces, true); insertChildren(surfaces); } --- 896,903 ---- * @param name The name * @param surfaces The surfaces + * @param sort boolean */ ! public SurfaceContainer(String name, Collection surfaces, boolean sort) { ! super(name, surfaces, sort); insertChildren(surfaces); } *************** *** 958,964 **** /** ! * Geometry Container */ ! public class GeometryContainer extends ContainerNode { /** * Constructor --- 946,952 ---- /** ! * Geometry Node */ ! public class GeometryNode extends GenericNode { /** * Constructor *************** *** 966,972 **** * @param space The space */ ! public GeometryContainer(String name, Space space) { ! super(name, null, false); ! add(new SurfaceContainer("Surfaces", space.getSurfaces())); add(new EdgeContainer("Edges", space.getEdges(), true)); add(new VertexContainer("Vertices", space.getVertices(), true)); --- 954,960 ---- * @param space The space */ ! public GeometryNode(String name, Space space) { ! super(name); ! add(new SurfaceContainer("Surfaces", space.getSurfaces(), true)); add(new EdgeContainer("Edges", space.getEdges(), true)); add(new VertexContainer("Vertices", space.getVertices(), true)); *************** *** 974,989 **** /** ! * Update the node with the given object ! * @param o The object */ public void update(Object o) { ! if (o instanceof Space) { ! Space s = (Space)o; ! ((SurfaceContainer)this.getChildAt(0)).update(s.getSurfaces()); ! ((EdgeContainer)this.getChildAt(1)).update(s.getEdges()); ! ((VertexContainer)this.getChildAt(2)).update(s.getVertices()); ! } else { ! log.warn("Expected a Space but found a " + o); ! } } } --- 962,979 ---- /** ! * {@inheritDoc} */ public void update(Object o) { ! Space space = (Space)o; ! updateChild(0, space.getSurfaces()); ! updateChild(1, space.getEdges()); ! updateChild(2, space.getVertices()); ! } ! ! /** ! * {@inheritDoc} ! */ ! public ImageIcon icon() { ! return genericgroupicon; } } *************** *** 1143,1146 **** --- 1133,1137 ---- public ComponentContainer(String name, Collection<Component> content) { super(name, content, false); + insertChildren(content); } *************** *** 1217,1221 **** public CameraNode(Camera c) { super(c, c.getClipplanes(), true); ! update(c); } --- 1208,1212 ---- public CameraNode(Camera c) { super(c, c.getClipplanes(), true); ! insertChildren(c.getClipplanes()); } *************** *** 1225,1237 **** */ public void update(Object o) { ! if (o instanceof Camera) { ! userObject = o; ! if (o == updated) { ! model.nodeChanged(this); ! } ! super.update(((Camera)o).getClipplanes()); ! } else { ! log.warn("Were a " + o + " not a Camera"); } } } --- 1216,1224 ---- */ public void update(Object o) { ! userObject = o; ! if (o == updated) { ! model.nodeChanged(this); } + super.update(((Camera)o).getClipplanes()); } } *************** *** 1338,1342 **** public ConstraintContainer(String name, Collection constraints) { super(name, constraints, true); ! update(constraints); } } --- 1325,1329 ---- public ConstraintContainer(String name, Collection constraints) { super(name, constraints, true); ! insertChildren(constraints); } } *************** *** 1353,1410 **** public RelationContainer(List<Relation> relations) { super("Relations", relations, true); ! update(relations); ! } ! } ! ! /** ! * TransformationContainer ! */ ! public class TransformationContainer extends ContainerNode { ! /** ! * Constructor for ConstraintContainer ! * @param name The name ! * @param transforms The constraints ! */ ! public TransformationContainer(String name, Stack transforms) { ! super(name, transforms, false); ! update(transforms); ! } ! ! /** ! * Update the node with the given object ! * @param o The object ! */ ! public void update(Object o) { ! if (o instanceof Stack) { ! content = (Stack) o; ! if (((Stack)o).size() != this.getChildCount()) { ! this.removeAllChildren(); ! LinkedList elem = new LinkedList(); ! Iterator iter = ((Stack)o).iterator(); ! while (iter.hasNext()) { ! elem.add(iter.next()); ! } ! this.insertChildren(elem); ! model.nodeStructureChanged(this); ! } ! } else { ! log.warn(userObject + " were called with " + o + " and not a list"); ! } ! } ! ! /** ! * Insert the given object into the node ! * @param elem the elements ! */ ! public void insertChildren(Collection elem) { ! int[] ins = new int[elem.size()]; ! int i = 0; ! Iterator iter = elem.iterator(); ! while (iter.hasNext()) { ! this.add(new EntityNode(iter.next())); ! ins[i] = this.getChildCount() - 1; ! i++; ! } ! model.nodesWereInserted(this, ins); } } --- 1340,1344 ---- public RelationContainer(List<Relation> relations) { super("Relations", relations, true); ! insertChildren(relations); } } Index: SpaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpaceTreeView.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** SpaceTreeView.java 19 Nov 2007 09:27:00 -0000 1.28 --- SpaceTreeView.java 10 Dec 2007 18:45:06 -0000 1.29 *************** *** 33,37 **** root.removeAllChildren(); root.add(new ProjectNode(p)); ! root.add(new GeometryContainer("Geometry", p.world())); root.add(new ConstraintContainer("Constraints", p.getConstraints())); root.add(new MaterialContainer("Materials", p.getMaterials(), true)); --- 33,37 ---- root.removeAllChildren(); root.add(new ProjectNode(p)); ! root.add(new GeometryNode("Geometry", p.world())); root.add(new ConstraintContainer("Constraints", p.getConstraints())); root.add(new MaterialContainer("Materials", p.getMaterials(), true)); *************** *** 48,51 **** --- 48,52 ---- */ public void update() { + long t0 = System.currentTimeMillis(); try { Project p = Project.getInstance(); *************** *** 61,64 **** --- 62,66 ---- "the root which resulted in a exception: " + e.getMessage()); } + long t1 = System.currentTimeMillis(); } } |
From: Michael L. <he...@us...> - 2007-12-10 13:47:32
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19504/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: cleanup Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** GenericTreeView.java 10 Dec 2007 13:31:17 -0000 1.128 --- GenericTreeView.java 10 Dec 2007 13:47:34 -0000 1.129 *************** *** 417,420 **** --- 417,430 ---- /** + * Update child with specifed index with the given object + * @param index index of child + * @param object object to update child with + */ + public void updateChild(int index, Object object) { + GenericNode child = (GenericNode) getChildAt(index); + child.update(object); + } + + /** * @param o the object to update with */ *************** *** 780,784 **** public void update(Object o) { super.update(o); ! ((GenericNode)getChildAt(0)).update(((Surface)o).getEdges()); } } --- 790,795 ---- public void update(Object o) { super.update(o); ! Surface surface = (Surface) o; ! updateChild(0, surface.getEdges()); } } *************** *** 816,820 **** if (o instanceof CoordinateSystem) { CoordinateSystem system = (CoordinateSystem) o; ! ((GenericNode)getChildAt(0)).update(system.relations()); } } --- 827,831 ---- if (o instanceof CoordinateSystem) { CoordinateSystem system = (CoordinateSystem) o; ! updateChild(0, system.relations()); } } *************** *** 849,855 **** public void update(Object o) { super.update(o); ! Edge e = (Edge)o; ! ((EntityNode)this.getChildAt(0)).update(e.getFrom()); ! ((EntityNode)this.getChildAt(1)).update(e.getTo()); } } --- 860,866 ---- public void update(Object o) { super.update(o); ! Edge edge = (Edge)o; ! updateChild(0, edge.getFrom()); ! updateChild(1, edge.getTo()); } } |
From: Michael L. <he...@us...> - 2007-12-10 13:31:14
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13239/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: small fixes Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** GenericTreeView.java 10 Dec 2007 12:08:25 -0000 1.127 --- GenericTreeView.java 10 Dec 2007 13:31:17 -0000 1.128 *************** *** 420,430 **** */ public void update(Object o) { ! if (o != null) { ! this.userObject = o; ! if (o == updated) { ! model.nodeChanged(this); ! } ! } else { ! log.warn("Tried to update with null on " + this); } } --- 420,426 ---- */ public void update(Object o) { ! this.userObject = o; ! if (o == updated) { ! model.nodeChanged(this); } } *************** *** 634,638 **** } else { Set surfaces = space.getEnvelope(); ! add(new SurfaceContainer("Surfaces", surfaces)); } } --- 630,634 ---- } else { Set surfaces = space.getEnvelope(); ! add(new SurfaceContainer("Envelope", surfaces)); } } *************** *** 646,650 **** add(new SurfaceContainer("Envelope", surfaces)); String lvlstr = Space.levelToString(space.getLevel() + 1); ! add(new ElementContainer(lvlstr, space.getElements())); add(new GeometryContainer("Geometry", space)); ContainerNode cn = new ConstructorContainer("Constructors", space.getConstructors()); --- 642,646 ---- add(new SurfaceContainer("Envelope", surfaces)); String lvlstr = Space.levelToString(space.getLevel() + 1); ! add(new ElementContainer(lvlstr + "s", space.getElements())); add(new GeometryContainer("Geometry", space)); ContainerNode cn = new ConstructorContainer("Constructors", space.getConstructors()); *************** *** 784,790 **** public void update(Object o) { super.update(o); ! if (o instanceof Surface) { ! ((GenericNode)getChildAt(0)).update(((Surface)o).getEdges()); ! } } } --- 780,784 ---- public void update(Object o) { super.update(o); ! ((GenericNode)getChildAt(0)).update(((Surface)o).getEdges()); } } *************** *** 819,831 **** */ public void update(Object o) { ! ! if (o instanceof Constructor) { ! if (updated == o) { ! model.nodeChanged(this); ! } ! if (o instanceof CoordinateSystem) { ! CoordinateSystem system = (CoordinateSystem) o; ! ((GenericNode)getChildAt(0)).update(system.relations()); ! } } } --- 813,820 ---- */ public void update(Object o) { ! super.update(o); ! if (o instanceof CoordinateSystem) { ! CoordinateSystem system = (CoordinateSystem) o; ! ((GenericNode)getChildAt(0)).update(system.relations()); } } *************** *** 859,870 **** */ public void update(Object o) { ! if (o instanceof Edge) { ! super.update(o); ! Edge e = (Edge)o; ! ((EntityNode)this.getChildAt(0)).update(e.getFrom()); ! ((EntityNode)this.getChildAt(1)).update(e.getTo()); ! } else { ! log.warn("Should be a edge but weren't" + o); ! } } } --- 848,855 ---- */ public void update(Object o) { ! super.update(o); ! Edge e = (Edge)o; ! ((EntityNode)this.getChildAt(0)).update(e.getFrom()); ! ((EntityNode)this.getChildAt(1)).update(e.getTo()); } } *************** *** 1175,1190 **** /** {@inheritDoc} */ @Override - public void update(Object o) { - if (o instanceof Component) { - Component lo = (Component)o; - if (lo != userObject) { - userObject = lo; - model.nodeChanged(this); - } - } - } - - /** {@inheritDoc} */ - @Override public JPopupMenu menu() { JPopupMenu menu = new JPopupMenu(); --- 1160,1163 ---- |
From: Michael L. <he...@us...> - 2007-12-10 13:31:09
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13226/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: small fixes Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.213 retrieving revision 1.214 diff -C2 -d -r1.213 -r1.214 *** Space.java 10 Dec 2007 10:58:45 -0000 1.213 --- Space.java 10 Dec 2007 13:31:11 -0000 1.214 *************** *** 219,223 **** */ public Space createFunctionalSpace(String name) { ! return new Space(name, Space.FUNCTIONAL, false); } --- 219,223 ---- */ public Space createFunctionalSpace(String name) { ! return new Space(name, Space.FUNCTIONAL, true); } |
From: Michael L. <he...@us...> - 2007-12-10 12:08:22
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13421/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: fixed a few bugs Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** GenericTreeView.java 7 Dec 2007 14:37:32 -0000 1.126 --- GenericTreeView.java 10 Dec 2007 12:08:25 -0000 1.127 *************** *** 724,730 **** } userObject = s; ! if (updated == s) { ! model.nodeChanged(this); ! } } } --- 724,728 ---- } userObject = s; ! model.nodeChanged(this); } } |
From: Michael L. <he...@us...> - 2007-12-10 12:08:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13404/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: fixed a few bugs Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** SpaceTool.java 10 Dec 2007 11:55:55 -0000 1.99 --- SpaceTool.java 10 Dec 2007 12:08:21 -0000 1.100 *************** *** 79,82 **** --- 79,83 ---- } } + super.pressed(e); } |
From: Michael L. <he...@us...> - 2007-12-10 11:56:04
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8626/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java ToolFactory.java SpaceTool.java SelectTool.java Log Message: Changed spacetool and menu handling Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** SpaceTool.java 28 Nov 2007 18:11:07 -0000 1.98 --- SpaceTool.java 10 Dec 2007 11:55:55 -0000 1.99 *************** *** 32,39 **** import net.sourceforge.bprocessor.gl.Editor; - import net.sourceforge.bprocessor.gui.PopupMenu; import net.sourceforge.bprocessor.gui.actions.SpaceMenuAction; import net.sourceforge.bprocessor.model.Edge; - import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Mesh; import net.sourceforge.bprocessor.model.Project; --- 32,37 ---- *************** *** 61,64 **** --- 59,65 ---- } + + + /** * Invoked when a mouse button has been pressed on a component. *************** *** 69,94 **** editor.setLengthValue(""); typing = false; - boolean done = false; - - if (e.getButton() == MouseEvent.BUTTON3 || e.isPopupTrigger()) { - Selection selection = Selection.primary(); - JPopupMenu menu = null; - - if (target == null) { - selection.clear(); - menu = PopupMenu.getBackgroundMenu(); - } else { - if (target instanceof Geometric) { - if (!selection.contains(target)) { - selection.set((Geometric) target); - } - menu = PopupMenu.makeSelectionMenu(); - } - } - if (menu != null) { - editor.popup(menu, e.getX(), e.getY()); - } - done = true; - } if (e.getButton() == MouseEvent.BUTTON1) { --- 70,73 ---- *************** *** 97,107 **** String side = (String)target; editor.popup(makeSpaceMenu(side), e.getX(), e.getY()); - } } } - if (!done) { - super.pressed(e); - } } --- 76,82 ---- Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** ToolFactory.java 3 Dec 2007 17:29:48 -0000 1.96 --- ToolFactory.java 10 Dec 2007 11:55:54 -0000 1.97 *************** *** 209,213 **** this.registerTool(Tool.SELECT_TOOL, select, "Biconselecttool.gif", "Select"); selBut.setMnemonic(KeyEvent.VK_Q); ! registerTool(Tool.ASSIGN_TOOL, assign, "Biconselecttool.gif", "Assign"); JToggleButton pencilBut = this.registerTool(Tool.PENCIL_TOOL, pencil, "Biconpentool.gif", "Pencil"); --- 209,213 ---- this.registerTool(Tool.SELECT_TOOL, select, "Biconselecttool.gif", "Select"); selBut.setMnemonic(KeyEvent.VK_Q); ! registerTool(Tool.ASSIGN_TOOL, assign, "Biconassigntool.gif", "Assign"); JToggleButton pencilBut = this.registerTool(Tool.PENCIL_TOOL, pencil, "Biconpentool.gif", "Pencil"); Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** SelectTool.java 18 Nov 2007 21:30:17 -0000 1.68 --- SelectTool.java 10 Dec 2007 11:55:55 -0000 1.69 *************** *** 8,15 **** --- 8,20 ---- import net.sourceforge.bprocessor.gl.Editor; + import net.sourceforge.bprocessor.gui.PopupMenu; + import net.sourceforge.bprocessor.model.Geometric; + import net.sourceforge.bprocessor.model.Selection; import java.awt.Cursor; import java.awt.event.MouseEvent; + import javax.swing.JPopupMenu; + /** * The selecttool *************** *** 72,74 **** --- 77,102 ---- " Drag to multi-select."; } + + /** + * {@inheritDoc} + */ + public void handleMenu(MouseEvent event) { + Selection selection = Selection.primary(); + JPopupMenu menu = null; + + if (target == null) { + selection.clear(); + menu = PopupMenu.getBackgroundMenu(); + } else { + if (target instanceof Geometric) { + if (!selection.contains(target)) { + selection.set((Geometric) target); + } + menu = PopupMenu.makeSelectionMenu(); + } + } + if (menu != null) { + editor.popup(menu, event.getX(), event.getY()); + } + } } Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** AbstractTool.java 21 Nov 2007 09:21:17 -0000 1.140 --- AbstractTool.java 10 Dec 2007 11:55:54 -0000 1.141 *************** *** 452,455 **** --- 452,464 ---- } + + /** + * Handle the menu for this tool + * @param event MouseEvent + */ + public void handleMenu(MouseEvent event) { + } + + /** * Invoked when a mouse button has been pressed on a component. *************** *** 480,484 **** Project.getInstance().setActiveSpace(clickbox.space()); } else { ! pressed(e); } } --- 489,498 ---- Project.getInstance().setActiveSpace(clickbox.space()); } else { ! ! if (e.getButton() == MouseEvent.BUTTON3 || e.isPopupTrigger()) { ! handleMenu(e); ! } else { ! pressed(e); ! } } } |