bprocessor-commit Mailing List for B-processor (Page 146)
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...> - 2005-12-20 12:23:24
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6852/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Geometry.java Camera.java Log Message: Fixed small issues Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** Surface.java 19 Dec 2005 19:37:54 -0000 1.57 --- Surface.java 20 Dec 2005 12:23:14 -0000 1.58 *************** *** 228,231 **** --- 228,245 ---- /** + * Reverse the order of the edges thereby flipping + * front and back of this Surface. + */ + void flip() { + List lst = new ArrayList(edges.size()); + Edge[] edges = new Edge[getEdges().size()]; + getEdges().toArray(edges); + for (int i = 0; i < edges.length; i++) { + lst.add(edges[edges.length - i - 1]); + } + setEdges(lst); + } + + /** * Replace the edge with the edges * @param edge The original edge Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Camera.java 19 Dec 2005 07:50:06 -0000 1.5 --- Camera.java 20 Dec 2005 12:23:14 -0000 1.6 *************** *** 56,60 **** if (type == VIEW_3D) { res = new Camera("3d", new double[]{0, 0, 0}, ! new double[]{20, 5, 5}, new double[] {0, 0, 1}); } else if (type == VIEW_XZ) { --- 56,60 ---- if (type == VIEW_3D) { res = new Camera("3d", new double[]{0, 0, 0}, ! new double[]{22, 19, 22}, new double[] {0, 0, 1}); } else if (type == VIEW_XZ) { *************** *** 334,336 **** --- 334,349 ---- forward.getY(), forward.getZ(), c.roll, new double[] {0, 0, 0}); } + + /** + * Print camera + * @return String + */ + public String toString() { + String s = getName() + + "[(" + + camera[0] + ", " + camera[1] + ", " + camera[2] + ",) -> (" + + center[0] + ", " + center[1] + ", " + center[2] + ",) ^ (" + + roll[0] + ", " + roll[1] + ", " + roll[2] + "]"; + return s; + } } Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Geometry.java 19 Dec 2005 07:50:06 -0000 1.7 --- Geometry.java 20 Dec 2005 12:23:14 -0000 1.8 *************** *** 202,205 **** --- 202,207 ---- private static void findSurfaces(VertexNode vertex, EdgeNode last, List edges, Surface exterior) { int count = 0; + List surfaces = new LinkedList(); + { Surface clockwise = clockwiseSurface(vertex, last, edges); *************** *** 207,210 **** --- 209,213 ---- if (clockwise.angle(vertex.system()) < 0) { Project.getInstance().intern(clockwise); + surfaces.add(clockwise); count++; } *************** *** 216,219 **** --- 219,223 ---- if (counterclockwise.angle(vertex.system()) > 0) { Project.getInstance().intern(counterclockwise); + surfaces.add(counterclockwise); count++; } *************** *** 222,225 **** --- 226,243 ---- if (exterior != null) { if (count == 2) { + Iterator iter = surfaces.iterator(); + Vertex normal = exterior.normal(); + normal.scale(1 / normal.length()); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + Vertex n = current.normal(); + n.scale(1 / n.length()); + Vertex o = n.add(normal); + if (o.isZero()) { + current.flip(); + } + current.setBackDomain(exterior.getBackDomain()); + current.setFrontDomain(exterior.getFrontDomain()); + } Project.getInstance().remove(exterior); } |
From: Nikolaj B. <nbr...@us...> - 2005-12-19 23:15:51
|
Update of /cvsroot/bprocessor/build/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17909/doc Added Files: Installation guide.doc Log Message: Installation guide for windows, in word format. --- NEW FILE: Installation guide.doc --- (This appears to be a binary file; contents omitted.) |
From: Michael L. <he...@us...> - 2005-12-19 19:38:04
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31996/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Surface.java Space.java Added Files: Entity.java Log Message: Entity added as superclass for Space, Surface, Edge and Vertex Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** Surface.java 19 Dec 2005 07:50:06 -0000 1.56 --- Surface.java 19 Dec 2005 19:37:54 -0000 1.57 *************** *** 7,11 **** package net.sourceforge.bprocessor.model; - import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; --- 7,10 ---- *************** *** 26,36 **** * usage="read-write" */ ! public class Surface implements Serializable { /** The logger */ private static Logger log = Logger.getLogger(Surface.class); - /** The id */ - private Long id; - /** Constructor */ private boolean constructor; --- 25,32 ---- * usage="read-write" */ ! public class Surface extends Entity { /** The logger */ private static Logger log = Logger.getLogger(Surface.class); /** Constructor */ private boolean constructor; *************** *** 74,96 **** /** - * Get the id - * @return The id - * @hibernate.id - * column="SURFACE_ID" - * generator-class="increment" - */ - public Long getId() { - return id; - } - - /** - * Set the id - * @param id The id - */ - public void setId(Long id) { - this.id = id; - } - - /** * Get the name * @return The name --- 70,73 ---- Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Space.java 12 Dec 2005 20:18:52 -0000 1.9 --- Space.java 19 Dec 2005 19:37:54 -0000 1.10 *************** *** 7,11 **** package net.sourceforge.bprocessor.model; - import java.io.Serializable; import java.util.HashSet; import java.util.Set; --- 7,10 ---- *************** *** 20,26 **** * column="DOMAIN_ID" */ ! public class Space implements Serializable { ! /** The id */ ! private Long id; /** The name */ private String name; --- 19,23 ---- * column="DOMAIN_ID" */ ! public class Space extends Entity { /** The name */ private String name; *************** *** 66,88 **** /** - * Get the id - * @return The id - * @hibernate.id - * column="DOMAIN_ID" - * generator-class="increment" - */ - public Long getId() { - return id; - } - - /** - * Set the id - * @param id The id - */ - public void setId(Long id) { - this.id = id; - } - - /** * Get the name * @return The name --- 63,66 ---- Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Vertex.java 19 Dec 2005 07:50:05 -0000 1.17 --- Vertex.java 19 Dec 2005 19:37:54 -0000 1.18 *************** *** 7,11 **** package net.sourceforge.bprocessor.model; - import java.io.Serializable; import java.util.HashSet; import java.util.Iterator; --- 7,10 ---- *************** *** 22,34 **** * usage="read-write" */ ! public class Vertex implements Serializable { /** The logger */ private static Logger log = Logger.getLogger(Vertex.class); - /** The id */ - private Long id; - - - /** The x coordinate */ private double x; --- 21,28 ---- * usage="read-write" */ ! public class Vertex extends Entity { /** The logger */ private static Logger log = Logger.getLogger(Vertex.class); /** The x coordinate */ private double x; *************** *** 60,82 **** /** - * Get the id - * @return The id - * @hibernate.id - * column="VERTEX_ID" - * generator-class="increment" - */ - public Long getId() { - return id; - } - - /** - * Set the id - * @param id The id - */ - public void setId(Long id) { - this.id = id; - } - - /** * Get the name * @return The name --- 54,57 ---- Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Edge.java 19 Dec 2005 07:50:05 -0000 1.23 --- Edge.java 19 Dec 2005 19:37:53 -0000 1.24 *************** *** 7,12 **** package net.sourceforge.bprocessor.model; - import java.io.Serializable; - import org.apache.log4j.Logger; --- 7,10 ---- *************** *** 23,33 **** * usage="read-write" */ ! public class Edge implements Serializable { /** The logger */ private static Logger log = Logger.getLogger(Edge.class); - /** The id */ - private Long id; - /** The start vertex */ private Vertex from; --- 21,28 ---- * usage="read-write" */ ! public class Edge extends Entity { /** The logger */ private static Logger log = Logger.getLogger(Edge.class); /** The start vertex */ private Vertex from; *************** *** 56,93 **** /** - * Get the id - * @return The id - * @hibernate.id - * column="EDGE_ID" - * generator-class="increment" - */ - public Long getId() { - return id; - } - - /** - * Set the id - * @param id The id - */ - public void setId(Long id) { - this.id = id; - } - - /** - * Get the name - * @return The name - * @hibernate.property - */ - public String getName() { - String name; - if (id == null) { - name = "E"; - } else { - name = "E" + id; - } - return name; - } - - /** * Get the to vertex * @return The end vertex --- 51,54 ---- *************** *** 144,147 **** --- 105,124 ---- } + + /** + * Get the name + * @return The name + * @hibernate.property + */ + public String getName() { + String name; + if (id == null) { + name = "E"; + } else { + name = "E" + id; + } + return name; + } + /** * Return the other vertex than the given one, if the given one is one of them --- NEW FILE: Entity.java --- //--------------------------------------------------------------------------------- // $Id: Entity.java,v 1.1 2005/12/19 19:37:54 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; import java.io.Serializable; /** * The entity class */ public class Entity implements Serializable { /** The id */ protected Long id; /** * Get the id * @return The id * @hibernate.id * column="EDGE_ID" * generator-class="increment" */ public Long getId() { return id; } /** * Set the id * @param id The id */ public void setId(Long id) { this.id = id; } /** * Get the name * @return The name */ public String getName() { return "Entity"; } } |
From: Michael L. <he...@us...> - 2005-12-19 07:51:41
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6606/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Transformation.java Log Message: Name removed Surface, Edge, and Vertex Work done on extrudetool Index: Transformation.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Transformation.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Transformation.java 20 Sep 2005 13:14:24 -0000 1.5 --- Transformation.java 19 Dec 2005 07:51:30 -0000 1.6 *************** *** 81,85 **** edges.add(project(current)); } ! Surface projected = new Surface("projection of " + surface.getName()); projected.setEdges(edges); return projected; --- 81,85 ---- edges.add(project(current)); } ! Surface projected = new Surface(); projected.setEdges(edges); return projected; *************** *** 94,98 **** Vertex from = project(edge.getFrom()); Vertex to = project(edge.getTo()); ! Edge projected = new Edge("projection of " + edge.getName()); projected.setFrom(from); projected.setTo(to); --- 94,98 ---- Vertex from = project(edge.getFrom()); Vertex to = project(edge.getTo()); ! Edge projected = new Edge(); projected.setFrom(from); projected.setTo(to); *************** *** 114,118 **** log.error("error projecting"); } ! Vertex projection = new Vertex("projection of " + vertex.getName()); projection.setX(view[0]); projection.setY(view[1]); --- 114,118 ---- log.error("error projecting"); } ! Vertex projection = new Vertex(); projection.setX(view[0]); projection.setY(view[1]); *************** *** 134,138 **** edges.add(unProject(current)); } ! Surface projected = new Surface("projection of " + surface.getName()); projected.setEdges(edges); return projected; --- 134,138 ---- edges.add(unProject(current)); } ! Surface projected = new Surface(); projected.setEdges(edges); return projected; *************** *** 147,151 **** Vertex from = unProject(edge.getFrom()); Vertex to = unProject(edge.getTo()); ! Edge projected = new Edge("projection of " + edge.getName()); projected.setFrom(from); projected.setTo(to); --- 147,151 ---- Vertex from = unProject(edge.getFrom()); Vertex to = unProject(edge.getTo()); ! Edge projected = new Edge(); projected.setFrom(from); projected.setTo(to); *************** *** 167,171 **** log.error("error un-projecting"); } ! Vertex projection = new Vertex("un-projection of " + vertex.getName()); projection.setX(round(view[0])); projection.setY(round(view[1])); --- 167,171 ---- log.error("error un-projecting"); } ! Vertex projection = new Vertex(); projection.setX(round(view[0])); projection.setY(round(view[1])); Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** View.java 15 Dec 2005 12:38:06 -0000 1.32 --- View.java 19 Dec 2005 07:51:30 -0000 1.33 *************** *** 559,563 **** Vertex n = system.getN(); ! Edge edge = new Edge("", from, from.add(n)); gl.glColor3d(0.0, 0.0, 1.0); drawEdge(edge); --- 559,563 ---- Vertex n = system.getN(); ! Edge edge = new Edge(from, from.add(n)); gl.glColor3d(0.0, 0.0, 1.0); drawEdge(edge); *************** *** 632,643 **** if (!facingFront(surface)) { ! frontTextAnchor = new Vertex("", front.getX() - (frontWidth / 2), front.getY() - 17, front.getZ()); ! backTextAnchor = new Vertex("", front.getX() - (backWidth / 2), front.getY() + 7, front.getZ()); } else { ! frontTextAnchor = new Vertex("", front.getX() - (frontWidth / 2), front.getY() + 7, front.getZ()); ! backTextAnchor = new Vertex("", front.getX() - (backWidth / 2), front.getY() - 17, front.getZ()); } --- 632,643 ---- if (!facingFront(surface)) { ! frontTextAnchor = new Vertex(front.getX() - (frontWidth / 2), front.getY() - 17, front.getZ()); ! backTextAnchor = new Vertex(front.getX() - (backWidth / 2), front.getY() + 7, front.getZ()); } else { ! frontTextAnchor = new Vertex(front.getX() - (frontWidth / 2), front.getY() + 7, front.getZ()); ! backTextAnchor = new Vertex(front.getX() - (backWidth / 2), front.getY() - 17, front.getZ()); } *************** *** 1353,1361 **** if (isVisible(s)) { if (side == FRONT) { ! Space back = s.getBackDomain(); gl.glColor3fv(getSpaceColor(back)); } if (side == BACK) { ! Space front = s.getFrontDomain(); gl.glColor3fv(getSpaceColor(front)); } --- 1353,1361 ---- if (isVisible(s)) { if (side == FRONT) { ! Space back = s.getFrontDomain(); gl.glColor3fv(getSpaceColor(back)); } if (side == BACK) { ! Space front = s.getBackDomain(); gl.glColor3fv(getSpaceColor(front)); } *************** *** 1901,1907 **** Transformation transformation = transformation(); Vertex origin = transformation.project(system.origin()); ! Vertex from = new Vertex("", origin.getX(), origin.getY(), 0.0); ! Vertex to = new Vertex("", origin.getX(), origin.getY(), 1.0); ! Edge ray = new Edge("", from, to); Vertex rayDir; --- 1901,1907 ---- Transformation transformation = transformation(); Vertex origin = transformation.project(system.origin()); ! Vertex from = new Vertex(origin.getX(), origin.getY(), 0.0); ! Vertex to = new Vertex(origin.getX(), origin.getY(), 1.0); ! Edge ray = new Edge(from, to); Vertex rayDir; *************** *** 2132,2138 **** Transformation transformation = transformation(); ! Vertex near = new Vertex("near", x, y, 0.0); ! Vertex far = new Vertex("far", x, y, 1.0); ! Edge ray = new Edge("ray", near, far); ray = transformation.unProject(ray); Vertex vertex = plane.intersection(ray); --- 2132,2138 ---- Transformation transformation = transformation(); ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ray = transformation.unProject(ray); Vertex vertex = plane.intersection(ray); |
From: Michael L. <he...@us...> - 2005-12-19 07:51:41
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6606/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java ExtrudeTool.java ExtrusionTool.java TapeMeasureTool.java CatmullClark.java AbstractTool.java CameraFlyTool.java PencilTool.java ToolFactory.java CameraWalkTool.java Log Message: Name removed Surface, Edge, and Vertex Work done on extrudetool Index: ExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrudeTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExtrudeTool.java 12 Dec 2005 14:33:22 -0000 1.2 --- ExtrudeTool.java 19 Dec 2005 07:51:29 -0000 1.3 *************** *** 10,13 **** --- 10,15 ---- import java.awt.Cursor; import java.awt.event.MouseEvent; + import java.util.Iterator; + import java.util.Set; import net.sourceforge.bprocessor.gl.GLView; *************** *** 16,19 **** --- 18,22 ---- import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; *************** *** 43,46 **** --- 46,55 ---- private double t = 0; + /** The upper limit */ + private double upperLimit; + + /** The lower limity */ + private double lowerLimit; + /** * Direction (1 or -1) *************** *** 72,78 **** double x = prevX; double y = View.getHeight() - prevY; ! Vertex near = new Vertex("near", x, y, 0.0); ! Vertex far = new Vertex("far", x, y, 1.0); ! Edge ray = new Edge("ray", near, far); ray = trans.unProject(ray); dragplane = extrudeSurface.plane().orthogonalPlane(ray); --- 81,87 ---- double x = prevX; double y = View.getHeight() - prevY; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ray = trans.unProject(ray); dragplane = extrudeSurface.plane().orthogonalPlane(ray); *************** *** 98,111 **** */ private void moveTo(double to) { ! if (direction > 0) { ! if (to < 0) { ! to = 0; ! } ! } else { ! if (to > 0) { ! to = 0; ! } } - double delta = to - t; move(delta); --- 107,116 ---- */ private void moveTo(double to) { ! if (to > upperLimit) { ! to = upperLimit; ! } ! if (to < lowerLimit) { ! to = lowerLimit; } double delta = to - t; move(delta); *************** *** 113,116 **** --- 118,169 ---- } + /** + * Find the limits of this extusion + * + */ + protected void findLimits() { + + if (direction > 0) { + lowerLimit = 0.0; + upperLimit = Double.POSITIVE_INFINITY; + } + if (direction < 0) { + upperLimit = 0.0; + lowerLimit = Double.NEGATIVE_INFINITY; + } + + Set surfaces = Project.getInstance().getSurfaces(); + Iterator iter = surfaces.iterator(); + Vertex normal = dragSurface.normal(); + Vertex origin = extrudeSurface.getFirstVertex(); + normal.scale(1 / normal.length()); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + if (current != extrudeSurface && current != dragSurface) { + Vertex n = current.normal(); + Vertex cross = normal.cross(n); + if (cross.isZero()) { + Vertex o = current.getFirstVertex(); + Vertex vector = o.minus(origin); + double d = vector.dot(normal); + if (direction > 0) { + if (d > 0.0000001) { + if (d < upperLimit) { + upperLimit = d; + } + } + } + if (direction < 0) { + if (d < -0.0000001) { + if (d > lowerLimit) { + lowerLimit = d; + } + } + } + } + } + } + } + /** *************** *** 143,146 **** --- 196,200 ---- direction = -1; } + findLimits(); } } else { *************** *** 156,159 **** --- 210,214 ---- protected void released(MouseEvent e) { super.released(e); + holeAnalysis(dragSurface); dragplane = null; dragSurface = null; Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** MoveTool.java 12 Dec 2005 14:33:22 -0000 1.19 --- MoveTool.java 19 Dec 2005 07:51:29 -0000 1.20 *************** *** 128,133 **** dragPlane = findMovePlane(target); initial = glv.getView().toPlaneCoords(new double[] {previousX, previousY}, dragPlane); ! parentPos = new Vertex("parent", initial.getX(), initial.getY(), initial.getZ()); ! from = new Vertex("from", initial.getX(), initial.getY(), initial.getZ()); vertices = new HashSet(); --- 128,133 ---- dragPlane = findMovePlane(target); initial = glv.getView().toPlaneCoords(new double[] {previousX, previousY}, dragPlane); ! parentPos = new Vertex(initial.getX(), initial.getY(), initial.getZ()); ! from = new Vertex(initial.getX(), initial.getY(), initial.getZ()); vertices = new HashSet(); *************** *** 170,176 **** double x = previousX; double y = View.getHeight() - previousY; ! Vertex near = new Vertex("near", x, y, 0.0); ! Vertex far = new Vertex("far", x, y, 1.0); ! Edge ray = new Edge("ray", near, far); ray = trans.unProject(ray); return temp.orthogonalPlane(ray); --- 170,176 ---- double x = previousX; double y = View.getHeight() - previousY; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ray = trans.unProject(ray); return temp.orthogonalPlane(ray); Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ToolFactory.java 15 Dec 2005 12:37:00 -0000 1.20 --- ToolFactory.java 19 Dec 2005 07:51:30 -0000 1.21 *************** *** 116,120 **** pencil = new PencilTool(glv, pencilcursor); move = new MoveTool(glv, pencilcursor); ! extrusion = new ExtrusionTool(glv, pencilcursor); clipplane = new ClipplaneTool(glv, pencilcursor); rotation = new CameraTool(glv, rotationCursor); --- 116,120 ---- pencil = new PencilTool(glv, pencilcursor); move = new MoveTool(glv, pencilcursor); ! extrusion = new ExtrudeTool(glv, pencilcursor); clipplane = new ClipplaneTool(glv, pencilcursor); rotation = new CameraTool(glv, rotationCursor); Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** ExtrusionTool.java 12 Dec 2005 14:33:22 -0000 1.34 --- ExtrusionTool.java 19 Dec 2005 07:51:29 -0000 1.35 *************** *** 184,190 **** double x = prevX; double y = View.getHeight() - prevY; ! Vertex near = new Vertex("near", x, y, 0.0); ! Vertex far = new Vertex("far", x, y, 1.0); ! Edge ray = new Edge("ray", near, far); ray = trans.unProject(ray); dragplane = selectedSurface.plane().orthogonalPlane(ray); --- 184,190 ---- double x = prevX; double y = View.getHeight() - prevY; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ray = trans.unProject(ray); dragplane = selectedSurface.plane().orthogonalPlane(ray); Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** PencilTool.java 12 Dec 2005 14:33:22 -0000 1.49 --- PencilTool.java 19 Dec 2005 07:51:30 -0000 1.50 *************** *** 38,48 **** /** The x axis */ ! private Edge xAxis = new Edge("x", new Vertex("", -50, 0, 0), new Vertex("", 50, 0, 0)); /** The y axis */ ! private Edge yAxis = new Edge("y", new Vertex("", 0, -50, 0), new Vertex("", 0, 50, 0)); /**The z axis */ ! private Edge zAxis = new Edge("z", new Vertex("", 0, 0, -50), new Vertex("", 0, 0, 50)); /** The constructors from the current vertex */ --- 38,48 ---- /** The x axis */ ! private Edge xAxis = new Edge(new Vertex(-50, 0, 0), new Vertex(50, 0, 0)); /** The y axis */ ! private Edge yAxis = new Edge(new Vertex(0, -50, 0), new Vertex(0, 50, 0)); /**The z axis */ ! private Edge zAxis = new Edge(new Vertex(0, 0, -50), new Vertex(0, 0, 50)); /** The constructors from the current vertex */ *************** *** 144,148 **** protected void intern(Vertex vertex) { if (vertex.getId() == null) { - vertex.setName("V" + vertexNum++); Project.getInstance().intern(vertex); } --- 144,147 ---- *************** *** 213,226 **** private Set makeXYZConstructors(Vertex v) { if (v != null) { ! Edge x = new Edge("xconst", ! xAxis.getFrom().add(v), xAxis.getTo().add(v)); x.setConstructor(true); ! Edge y = new Edge("yconst", ! yAxis.getFrom().add(v), yAxis.getTo().add(v)); y.setConstructor(true); ! Edge z = new Edge("zconst", ! zAxis.getFrom().add(v), zAxis.getTo().add(v)); z.setConstructor(true); --- 212,222 ---- private Set makeXYZConstructors(Vertex v) { if (v != null) { ! Edge x = new Edge(xAxis.getFrom().add(v), xAxis.getTo().add(v)); x.setConstructor(true); ! Edge y = new Edge(yAxis.getFrom().add(v), yAxis.getTo().add(v)); y.setConstructor(true); ! Edge z = new Edge(zAxis.getFrom().add(v), zAxis.getTo().add(v)); z.setConstructor(true); *************** *** 252,258 **** minus.scale(-1); Vertex firstTo = minus.copy(); ! Edge first = new Edge("first", firstFrom, firstTo); minus.scale(1 / minus.length()); ! Vertex ortho = new Vertex("ortho", 0, 0, 0); if (minus.getX() != 0) { if (minus.getY() != 0) { --- 248,254 ---- minus.scale(-1); Vertex firstTo = minus.copy(); ! Edge first = new Edge(firstFrom, firstTo); minus.scale(1 / minus.length()); ! Vertex ortho = new Vertex(0, 0, 0); if (minus.getX() != 0) { if (minus.getY() != 0) { *************** *** 276,280 **** ortho.scale(-1); Vertex secondTo = ortho.copy(); ! Edge second = new Edge("second", secondFrom, secondTo); ortho.scale(1 / ortho.length()); --- 272,276 ---- ortho.scale(-1); Vertex secondTo = ortho.copy(); ! Edge second = new Edge(secondFrom, secondTo); ortho.scale(1 / ortho.length()); *************** *** 285,289 **** cross.scale(-1); Vertex thirdTo = cross.copy(); ! Edge third = new Edge("third", thirdFrom, thirdTo); first.setTo(first.getTo().add(v)); --- 281,285 ---- cross.scale(-1); Vertex thirdTo = cross.copy(); ! Edge third = new Edge(thirdFrom, thirdTo); first.setTo(first.getTo().add(v)); *************** *** 361,366 **** intern(vertex); from = vertex; ! to = new Vertex("Mouse", vertex.getX(), vertex.getY(), vertex.getZ()); ! active = new Edge("E" + edgeNum++, from, to); glv.getView().setActiveEdge(active); } else { --- 357,362 ---- intern(vertex); from = vertex; ! to = new Vertex(vertex.getX(), vertex.getY(), vertex.getZ()); ! active = new Edge(from, to); glv.getView().setActiveEdge(active); } else { *************** *** 374,378 **** from = vertex; ! active = new Edge("E" + edgeNum++, from, to); glv.getView().setActiveEdge(active); --- 370,374 ---- from = vertex; ! active = new Edge(from, to); glv.getView().setActiveEdge(active); *************** *** 388,414 **** Vertex to = ((Edge) edges.get(edges.size() - 1)).getTo(); if (from == to) { ! Surface surface = new Surface("S" + surfaceNum++, edges); ! ! ! Set surfaces = Project.getInstance().getSurfaces(); ! Iterator iter = surfaces.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! if (current.surrounds(surface)) { ! current.addHole(surface); ! } else if (surface.surrounds(current)) { ! surface.addHole(current); ! } ! } intern(surface); - - exterior = null; - - if (exterior != null) { - exterior.addHole(surface); - Project.getInstance().update(exterior); - Project.getInstance().update(surface); - } - } else { Geometry.insert(edges); --- 384,390 ---- Vertex to = ((Edge) edges.get(edges.size() - 1)).getTo(); if (from == to) { ! Surface surface = new Surface(edges); ! holeAnalysis(surface); intern(surface); } else { Geometry.insert(edges); *************** *** 548,554 **** View v = glv.getView(); Transformation transformation = v.transformation(); ! Vertex near = new Vertex("near", x, y, 0.0); ! Vertex far = new Vertex("far", x, y, 1.0); ! Edge ray = new Edge("ray", near, far); ray = transformation.unProject(ray); CoordinateSystem system = null; --- 524,530 ---- View v = glv.getView(); Transformation transformation = v.transformation(); ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ray = transformation.unProject(ray); CoordinateSystem system = null; *************** *** 563,567 **** Vertex vertex = plane.intersection(ray); system = surface.coordinateSystem(); - vertex.setName("current"); current = vertex; if (active != null) { --- 539,542 ---- *************** *** 581,585 **** Edge intersection = edge.intersection(ray); Vertex vertex = intersection.getFrom(); - vertex.setName("current"); current = vertex; splitE1 = edge; --- 556,559 ---- *************** *** 593,609 **** // of the following round off vertex.setZ(0.0); - vertex.setName("xy-plane"); current = vertex; } else { // just to take an initial bug ! current = new Vertex("", 0, 0, 0); } } if (current.getId() == null) { if (snap) { ! Vertex origin = new Vertex("", 0, 0, 0); ! Vertex i = new Vertex("", 1, 0, 0); ! Vertex j = new Vertex("", 0, 1, 0); ! Vertex n = new Vertex("", 0, 0, 1); system = new CoordinateSystem(i, j, n, origin); //snapInSystem(system, current); --- 567,582 ---- // of the following round off vertex.setZ(0.0); current = vertex; } else { // just to take an initial bug ! current = new Vertex(0, 0, 0); } } if (current.getId() == null) { if (snap) { ! Vertex origin = new Vertex(0, 0, 0); ! Vertex i = new Vertex(1, 0, 0); ! Vertex j = new Vertex(0, 1, 0); ! Vertex n = new Vertex(0, 0, 1); system = new CoordinateSystem(i, j, n, origin); //snapInSystem(system, current); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** AbstractTool.java 15 Dec 2005 13:02:47 -0000 1.39 --- AbstractTool.java 19 Dec 2005 07:51:30 -0000 1.40 *************** *** 81,84 **** --- 81,85 ---- selection = new HashSet(); } + /** *************** *** 142,145 **** --- 143,166 ---- return center; } + + /** + * See if surface has become a hole in a surface in + * the project. + * @param surface The surface + */ + protected void holeAnalysis(Surface surface) { + Set surfaces = Project.getInstance().getSurfaces(); + Iterator iter = surfaces.iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + if (current != surface) { + if (current.surrounds(surface)) { + current.addHole(surface); + } else if (surface.surrounds(current)) { + surface.addHole(current); + } + } + } + } /** *************** *** 368,372 **** protected Vertex createVertex(double[] coord) { if (coord.length == 3) { ! Vertex v = new Vertex("V" + vertexNum); vertexNum++; --- 389,393 ---- protected Vertex createVertex(double[] coord) { if (coord.length == 3) { ! Vertex v = new Vertex(); vertexNum++; *************** *** 390,395 **** protected Vertex createVertex(Vertex vertex) { if (vertex != null) { ! Vertex v = new Vertex("V" + vertexNum, ! vertex.getX(), vertex.getY(), vertex.getZ()); --- 411,415 ---- protected Vertex createVertex(Vertex vertex) { if (vertex != null) { ! Vertex v = new Vertex(vertex.getX(), vertex.getY(), vertex.getZ()); *************** *** 434,438 **** */ protected Edge createEdge(Vertex from, Vertex to) { ! Edge e = new Edge("E" + edgeNum++); e.setTo(to); e.setFrom(from); --- 454,458 ---- */ protected Edge createEdge(Vertex from, Vertex to) { ! Edge e = new Edge(); e.setTo(to); e.setFrom(from); *************** *** 463,468 **** */ protected Surface createSurface(List list) { ! Surface s = new Surface("S" + surfaceNum++); ! s.setEdges(list); Project.getInstance().intern(s); return s; --- 483,487 ---- */ protected Surface createSurface(List list) { ! Surface s = new Surface(list); Project.getInstance().intern(s); return s; Index: CameraWalkTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraWalkTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CameraWalkTool.java 15 Dec 2005 12:37:00 -0000 1.1 --- CameraWalkTool.java 19 Dec 2005 07:51:30 -0000 1.2 *************** *** 75,83 **** public void keyPressed(KeyEvent e) { Camera c = glv.getView().getCamera(); ! Vertex up = new Vertex("", c.getRoll()[0], c.getRoll()[1], c.getRoll()[2]); double x = c.getCenter()[0] - c.getCamera()[0]; double y = c.getCenter()[1] - c.getCamera()[1]; double z = c.getCenter()[2] - c.getCamera()[2]; ! Vertex forward = new Vertex("", x, y, z); forward.scale(2 / forward.length()); Vertex sidewards = up.cross(forward); --- 75,83 ---- public void keyPressed(KeyEvent e) { Camera c = glv.getView().getCamera(); ! Vertex up = new Vertex(c.getRoll()[0], c.getRoll()[1], c.getRoll()[2]); double x = c.getCenter()[0] - c.getCamera()[0]; double y = c.getCenter()[1] - c.getCamera()[1]; double z = c.getCenter()[2] - c.getCamera()[2]; ! Vertex forward = new Vertex(x, y, z); forward.scale(2 / forward.length()); Vertex sidewards = up.cross(forward); Index: CameraFlyTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraFlyTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CameraFlyTool.java 15 Dec 2005 12:37:00 -0000 1.3 --- CameraFlyTool.java 19 Dec 2005 07:51:30 -0000 1.4 *************** *** 75,83 **** public void keyPressed(KeyEvent e) { Camera c = glv.getView().getCamera(); ! Vertex up = new Vertex("", c.getRoll()[0], c.getRoll()[1], c.getRoll()[2]); double x = c.getCenter()[0] - c.getCamera()[0]; double y = c.getCenter()[1] - c.getCamera()[1]; double z = c.getCenter()[2] - c.getCamera()[2]; ! Vertex forward = new Vertex("", x, y, z); forward.scale(2 / forward.length()); Vertex sidewards = up.cross(forward); --- 75,83 ---- public void keyPressed(KeyEvent e) { Camera c = glv.getView().getCamera(); ! Vertex up = new Vertex(c.getRoll()[0], c.getRoll()[1], c.getRoll()[2]); double x = c.getCenter()[0] - c.getCamera()[0]; double y = c.getCenter()[1] - c.getCamera()[1]; double z = c.getCenter()[2] - c.getCamera()[2]; ! Vertex forward = new Vertex(x, y, z); forward.scale(2 / forward.length()); Vertex sidewards = up.cross(forward); Index: TapeMeasureTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasureTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TapeMeasureTool.java 12 Dec 2005 14:33:22 -0000 1.4 --- TapeMeasureTool.java 19 Dec 2005 07:51:30 -0000 1.5 *************** *** 30,40 **** /** The x axis */ ! private Edge xAxis = new Edge("x", new Vertex("", -50, 0, 0), new Vertex("", 50, 0, 0)); /** The y axis */ ! private Edge yAxis = new Edge("y", new Vertex("", 0, -50, 0), new Vertex("", 0, 50, 0)); /**The z axis */ ! private Edge zAxis = new Edge("z", new Vertex("", 0, 0, -50), new Vertex("", 0, 0, 50)); /** The current edge */ --- 30,40 ---- /** The x axis */ ! private Edge xAxis = new Edge(new Vertex(-50, 0, 0), new Vertex(50, 0, 0)); /** The y axis */ ! private Edge yAxis = new Edge(new Vertex(0, -50, 0), new Vertex(0, 50, 0)); /**The z axis */ ! private Edge zAxis = new Edge(new Vertex(0, 0, -50), new Vertex(0, 0, 50)); /** The current edge */ *************** *** 83,95 **** if (currentEdge.equals(xAxis)) { movePlane = new Plane(0, 0, 1, 0); ! edgeNormal = new Vertex("", 0, 1, 0); move(e); } else if (currentEdge.equals(yAxis)) { movePlane = new Plane(0, 0, 1, 0); ! edgeNormal = new Vertex("", 1, 0, 0); move(e); } else if (currentEdge.equals(zAxis)) { movePlane = new Plane(0, 1, 0, 0); ! edgeNormal = new Vertex("", 1, 0, 0); move(e); } else { --- 83,95 ---- if (currentEdge.equals(xAxis)) { movePlane = new Plane(0, 0, 1, 0); ! edgeNormal = new Vertex(0, 1, 0); move(e); } else if (currentEdge.equals(yAxis)) { movePlane = new Plane(0, 0, 1, 0); ! edgeNormal = new Vertex(1, 0, 0); move(e); } else if (currentEdge.equals(zAxis)) { movePlane = new Plane(0, 1, 0, 0); ! edgeNormal = new Vertex(1, 0, 0); move(e); } else { *************** *** 127,133 **** View v = glv.getView(); Transformation transformation = v.transformation(); ! Vertex near = new Vertex("near", x, y, 0.0); ! Vertex far = new Vertex("far", x, y, 1.0); ! Edge ray = new Edge("ray", near, far); ray = transformation.unProject(ray); Vertex intersect = movePlane.intersection(ray); --- 127,133 ---- View v = glv.getView(); Transformation transformation = v.transformation(); ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ray = transformation.unProject(ray); Vertex intersect = movePlane.intersection(ray); *************** *** 181,192 **** double y = View.getHeight() - e.getY(); Transformation transformation = v.transformation(); ! Vertex near = new Vertex("near", x, y, 0.0); ! Vertex far = new Vertex("far", x, y, 1.0); ! Edge ray = new Edge("ray", near, far); ray = transformation.unProject(ray); Edge intersection = currentEdge.intersection(ray); edgePoint = intersection.getFrom(); constructionPoint = edgePoint.copy(); ! edgeToConstruction = new Edge("lengthEdge", edgePoint, constructionPoint); edgeToConstruction.setConstructor(true); v.addTempEdge(edgeToConstruction); --- 181,192 ---- double y = View.getHeight() - e.getY(); Transformation transformation = v.transformation(); ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ray = transformation.unProject(ray); Edge intersection = currentEdge.intersection(ray); edgePoint = intersection.getFrom(); constructionPoint = edgePoint.copy(); ! edgeToConstruction = new Edge(edgePoint, constructionPoint); edgeToConstruction.setConstructor(true); v.addTempEdge(edgeToConstruction); Index: CatmullClark.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CatmullClark.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CatmullClark.java 30 Nov 2005 23:04:54 -0000 1.3 --- CatmullClark.java 19 Dec 2005 07:51:30 -0000 1.4 *************** *** 83,87 **** Vertex from = (Vertex) vertexmap.get(current.getFrom()); Vertex to = (Vertex) vertexmap.get(current.getTo()); ! Edge edge = new Edge("", from, to); edgemap.put(current, edge); } --- 83,87 ---- Vertex from = (Vertex) vertexmap.get(current.getFrom()); Vertex to = (Vertex) vertexmap.get(current.getTo()); ! Edge edge = new Edge(from, to); edgemap.put(current, edge); } *************** *** 99,103 **** edges.add(edge); } ! surfaces.add(new Surface("", edges)); } } --- 99,103 ---- edges.add(edge); } ! surfaces.add(new Surface(edges)); } } *************** *** 235,239 **** } if (edge == null) { ! edge = new Edge("", from, to); fl.add(edge); tl.add(edge); --- 235,239 ---- } if (edge == null) { ! edge = new Edge(from, to); fl.add(edge); tl.add(edge); *************** *** 256,260 **** edges.add(e3); edges.add(e4); ! return new Surface("", edges); } --- 256,260 ---- edges.add(e3); edges.add(e4); ! return new Surface(edges); } *************** *** 373,377 **** Edge current = (Edge) iter.next(); double[] values = current.center(); ! Vertex center = new Vertex("", values[0], values[1], values[2]); edgepoints.add(center); edgemap.put(current, center); --- 373,377 ---- Edge current = (Edge) iter.next(); double[] values = current.center(); ! Vertex center = new Vertex(values[0], values[1], values[2]); edgepoints.add(center); edgemap.put(current, center); |
From: Michael L. <he...@us...> - 2005-12-19 07:51:41
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6606/src/net/sourceforge/bprocessor/gl/model Modified Files: ClippingPlane.java Log Message: Name removed Surface, Edge, and Vertex Work done on extrudetool Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model/ClippingPlane.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ClippingPlane.java 28 Nov 2005 22:24:51 -0000 1.5 --- ClippingPlane.java 19 Dec 2005 07:51:30 -0000 1.6 *************** *** 142,149 **** } } ! Vertex v1 = new Vertex("", minX - 1, minY - 1, 0.0); ! Vertex v2 = new Vertex("", minX - 1, maxY + 1, 0.0); ! Vertex v3 = new Vertex("", maxX + 1, maxY + 1, 0.0); ! Vertex v4 = new Vertex("", maxX + 1, minY - 1, 0.0); v1 = system.unTranslate(v1); v2 = system.unTranslate(v2); --- 142,149 ---- } } ! Vertex v1 = new Vertex(minX - 1, minY - 1, 0.0); ! Vertex v2 = new Vertex(minX - 1, maxY + 1, 0.0); ! Vertex v3 = new Vertex(maxX + 1, maxY + 1, 0.0); ! Vertex v4 = new Vertex(maxX + 1, minY - 1, 0.0); v1 = system.unTranslate(v1); v2 = system.unTranslate(v2); *************** *** 156,223 **** corners.add(v4); } - - /** - * Find a lot of corners among intersections - */ - public void findManyCorners() { - log.info(plane); - Collection c = findIntersections(); - Iterator it = c.iterator(); - double minX = Integer.MAX_VALUE; - double minY = Integer.MAX_VALUE; - double minZ = Integer.MAX_VALUE; - double maxX = Integer.MIN_VALUE; - double maxY = Integer.MIN_VALUE; - double maxZ = Integer.MIN_VALUE; - while (it.hasNext()) { - Vertex v = (Vertex)it.next(); - log.info(v); - if (v.getX() < minX) { - minX = v.getX(); - } - if (v.getX() > maxX) { - maxX = v.getX(); - } - if (v.getY() < minY) { - minY = v.getY(); - } - if (v.getY() > maxY) { - maxY = v.getY(); - } - if (v.getZ() < minZ) { - minZ = v.getZ(); - } - if (v.getZ() > maxZ) { - maxZ = v.getZ(); - } - } - - double[] abcd = plane.getDoublev(); - corners = new ArrayList(); - if (Math.abs(minX * abcd[0] + minY * abcd[1] + maxZ * abcd[2] + abcd[3]) < 0.001) { - corners.add(new Vertex("v1", minX, minY, maxZ)); - } - if (Math.abs(minX * abcd[0] + maxY * abcd[1] + maxZ * abcd[2] + abcd[3]) < 0.001) { - corners.add(new Vertex("v2", minX, maxY, maxZ)); - } - if (Math.abs(minX * abcd[0] + minY * abcd[1] + minZ * abcd[2] + abcd[3]) < 0.001) { - corners.add(new Vertex("v3", minX, minY, minZ)); - } - if (Math.abs(minX * abcd[0] + maxY * abcd[1] + minZ * abcd[2] + abcd[3]) < 0.001) { - corners.add(new Vertex("v4", minX, maxY, minZ)); - } - if (Math.abs(maxX * abcd[0] + minY * abcd[1] + minZ * abcd[2] + abcd[3]) < 0.001) { - corners.add(new Vertex("v7", maxX, minY, minZ)); - } - if (Math.abs(maxX * abcd[0] + maxY * abcd[1] + minZ * abcd[2] + abcd[3]) < 0.001) { - corners.add(new Vertex("v8", maxX, maxY, minZ)); - } - if (Math.abs(maxX * abcd[0] + minY * abcd[1] + maxZ * abcd[2] + abcd[3]) < 0.001) { - corners.add(new Vertex("v5", maxX, minY, maxZ)); - } - if (Math.abs(maxX * abcd[0] + maxY * abcd[1] + maxZ * abcd[2] + abcd[3]) < 0.001) { - corners.add(new Vertex("v6", maxX, maxY, maxZ)); - } - } /** --- 156,159 ---- |
From: Michael L. <he...@us...> - 2005-12-19 07:50:40
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6481/src/net/sourceforge/bprocessor/gui/actions Modified Files: CreateConstructorActionListener.java CreateSurfaceActionListener.java Log Message: Name removed Surface, Edge, and Vertex Index: CreateConstructorActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/CreateConstructorActionListener.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CreateConstructorActionListener.java 2 Oct 2005 14:37:10 -0000 1.5 --- CreateConstructorActionListener.java 19 Dec 2005 07:50:31 -0000 1.6 *************** *** 44,48 **** if (result != null && !result.trim().equals("")) { ! Surface s = new Surface(result.trim()); s.setConstructor(true); --- 44,48 ---- if (result != null && !result.trim().equals("")) { ! Surface s = new Surface(); s.setConstructor(true); Index: CreateSurfaceActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/CreateSurfaceActionListener.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CreateSurfaceActionListener.java 2 Oct 2005 14:37:10 -0000 1.6 --- CreateSurfaceActionListener.java 19 Dec 2005 07:50:31 -0000 1.7 *************** *** 44,48 **** if (result != null && !result.trim().equals("")) { ! Surface s = new Surface(result.trim()); Project.getInstance().intern(s); --- 44,48 ---- if (result != null && !result.trim().equals("")) { ! Surface s = new Surface(); Project.getInstance().intern(s); |
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6368/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Surface.java Geometry.java Camera.java Project.java Plane.java CoordinateSystem.java Log Message: Name removed Surface, Edge, and Vertex Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CoordinateSystem.java 6 Nov 2005 16:25:34 -0000 1.7 --- CoordinateSystem.java 19 Dec 2005 07:50:06 -0000 1.8 *************** *** 135,139 **** */ public Vertex perpendicular(Vertex vector) { ! Vertex projection = new Vertex("n projection of vector"); projection.setX(n.getX()); projection.setY(n.getY()); --- 135,139 ---- */ public Vertex perpendicular(Vertex vector) { ! Vertex projection = new Vertex(); projection.setX(n.getX()); projection.setY(n.getY()); Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** Surface.java 16 Dec 2005 15:53:34 -0000 1.55 --- Surface.java 19 Dec 2005 07:50:06 -0000 1.56 *************** *** 33,39 **** private Long id; - /** The name */ - private String name; - /** Constructor */ private boolean constructor; --- 33,36 ---- *************** *** 63,93 **** /** ! * Constructor for persistence layer ! */ ! Surface() { ! } ! ! /** ! * Constructor ! * @param name The name */ ! public Surface(String name) { ! super(); ! setName(name); ! setConstructor(false); ! setIsInner(false); ! setEdges(null); ! setInnerSurfaces(null); ! setBackDomain(null); ! setFrontDomain(null); } /** * Constructor - * @param name The name * @param edges The edges */ ! public Surface(String name, List edges) { ! this(name); setEdges(edges); } --- 60,73 ---- /** ! * Constructor for surface */ ! public Surface() { } /** * Constructor * @param edges The edges */ ! public Surface(List edges) { setEdges(edges); } *************** *** 118,133 **** */ public String getName() { return name; } /** - * Set the name - * @param name The name - */ - public void setName(String name) { - this.name = name; - } - - /** * Is the surface a constructor * @return True if constructor; otherwise false --- 98,111 ---- */ public String getName() { + String name; + if (id == null) { + name = "S"; + } else { + name = "S" + id; + } return name; } /** * Is the surface a constructor * @return True if constructor; otherwise false *************** *** 263,267 **** y = y / (double) vertices.size(); z = z / (double) vertices.size(); ! return new Vertex("center of " + getName(), x, y, z); } else { return null; --- 241,245 ---- y = y / (double) vertices.size(); z = z / (double) vertices.size(); ! return new Vertex(x, y, z); } else { return null; *************** *** 376,380 **** */ public Surface copy() { ! Surface surface = new Surface(getName()); HashMap map = new HashMap(); --- 354,358 ---- */ public Surface copy() { ! Surface surface = new Surface(); HashMap map = new HashMap(); *************** *** 383,387 **** while (iter.hasNext()) { Edge current = (Edge) iter.next(); ! Edge newEdge = new Edge(current.getName()); Vertex from = current.getFrom(); Vertex newFrom = (Vertex) map.get(from.getId()); --- 361,365 ---- while (iter.hasNext()) { Edge current = (Edge) iter.next(); ! Edge newEdge = new Edge(); Vertex from = current.getFrom(); Vertex newFrom = (Vertex) map.get(from.getId()); *************** *** 452,461 **** for (int i = 0; i < n; i++) { ! topmap[i] = new Edge("", vmap[i], vmap[(i + 1) % n]); Project.getInstance().intern(topmap[i]); } for (int i = 0; i < n; i++) { ! sidemap[i] = new Edge("", v[i], vmap[i]); Project.getInstance().intern(sidemap[i]); } --- 430,439 ---- for (int i = 0; i < n; i++) { ! topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); Project.getInstance().intern(topmap[i]); } for (int i = 0; i < n; i++) { ! sidemap[i] = new Edge(v[i], vmap[i]); Project.getInstance().intern(sidemap[i]); } *************** *** 471,475 **** newEdges.add(l); newEdges.add(b); ! facemap[i] = new Surface("", newEdges); Project.getInstance().intern(facemap[i]); --- 449,453 ---- newEdges.add(l); newEdges.add(b); ! facemap[i] = new Surface(newEdges); Project.getInstance().intern(facemap[i]); *************** *** 481,485 **** newEdges.add(topmap[n - i - 1]); } ! top = new Surface("", newEdges); Project.getInstance().intern(top); } --- 459,463 ---- newEdges.add(topmap[n - i - 1]); } ! top = new Surface(newEdges); Project.getInstance().intern(top); } *************** *** 967,971 **** */ public String toString() { ! return "Surface[id=" + id + " " + name + " #" + edges.size() + "]"; } } --- 945,949 ---- */ public String toString() { ! return getName() + "[" + edges.size() + "]"; } } Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Edge.java 5 Dec 2005 07:53:46 -0000 1.22 --- Edge.java 19 Dec 2005 07:50:05 -0000 1.23 *************** *** 30,36 **** private Long id; - /** The name */ - private String name; - /** The start vertex */ private Vertex from; --- 30,33 ---- *************** *** 43,71 **** /** - * Constructor for persistence layer - */ - Edge() { - } - - /** * Constructor - * @param name The name */ ! public Edge(String name) { ! super(); ! setName(name); ! setFrom(null); ! setTo(null); ! setConstructor(false); } /** * Constructor - * @param name The name * @param from The to vertex * @param to The from vertex */ ! public Edge(String name, Vertex from, Vertex to) { ! this(name); setFrom(from); setTo(to); --- 40,54 ---- /** * Constructor */ ! public Edge() { } /** * Constructor * @param from The to vertex * @param to The from vertex */ ! public Edge(Vertex from, Vertex to) { setFrom(from); setTo(to); *************** *** 97,112 **** */ public String getName() { return name; } /** - * Set the name - * @param name The name - */ - public void setName(String name) { - this.name = name; - } - - /** * Get the to vertex * @return The end vertex --- 80,93 ---- */ public String getName() { + String name; + if (id == null) { + name = "E"; + } else { + name = "E" + id; + } return name; } /** * Get the to vertex * @return The end vertex *************** *** 191,195 **** */ public Edge copy() { ! Edge edge = new Edge(getName()); edge.setFrom(getFrom().copy()); edge.setTo(getTo().copy()); --- 172,176 ---- */ public Edge copy() { ! Edge edge = new Edge(); edge.setFrom(getFrom().copy()); edge.setTo(getTo().copy()); *************** *** 251,260 **** Vertex p4 = other.getTo(); ! Vertex pa = new Vertex("pa"); ! Vertex pb = new Vertex("pb"); ! Vertex p13 = new Vertex("p13"); ! Vertex p43 = new Vertex("p43"); ! Vertex p21 = new Vertex("p21"); double d1343, d4321, d1321, d4343, d2121; double numer, denom; --- 232,241 ---- Vertex p4 = other.getTo(); ! Vertex pa = new Vertex(); ! Vertex pb = new Vertex(); ! Vertex p13 = new Vertex(); ! Vertex p43 = new Vertex(); ! Vertex p21 = new Vertex(); double d1343, d4321, d1321, d4343, d2121; double numer, denom; *************** *** 299,303 **** pb.setZ(p3.getZ() + mub * p43.getZ()); ! return new Edge("intersection", pa, pb); } --- 280,284 ---- pb.setZ(p3.getZ() + mub * p43.getZ()); ! return new Edge(pa, pb); } *************** *** 308,320 **** */ public void split(Vertex vertex) { - /* - * TODO to split this edge by the vertex - */ if (!constructor) { Vertex from = getFrom(); Vertex to = getTo(); ! Edge e1 = new Edge("", from, vertex); Project.getInstance().intern(e1); ! Edge e2 = new Edge("", vertex, to); Project.getInstance().intern(e2); --- 289,298 ---- */ public void split(Vertex vertex) { if (!constructor) { Vertex from = getFrom(); Vertex to = getTo(); ! Edge e1 = new Edge(from, vertex); Project.getInstance().intern(e1); ! Edge e2 = new Edge(vertex, to); Project.getInstance().intern(e2); Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Plane.java 5 Dec 2005 07:53:46 -0000 1.10 --- Plane.java 19 Dec 2005 07:50:06 -0000 1.11 *************** *** 70,77 **** Vertex to = rayIn.getTo(); Vertex from = rayIn.getFrom(); ! Vertex alfa = new Vertex("", to.getX() - from.getX(), to.getY() - from.getY(), to.getZ() - from.getZ()); ! Vertex beta = new Vertex("", a, b, c); Vertex temp = alfa.cross(beta); Vertex norm = temp.cross(beta); --- 70,77 ---- Vertex to = rayIn.getTo(); Vertex from = rayIn.getFrom(); ! Vertex alfa = new Vertex(to.getX() - from.getX(), to.getY() - from.getY(), to.getZ() - from.getZ()); ! Vertex beta = new Vertex(a, b, c); Vertex temp = alfa.cross(beta); Vertex norm = temp.cross(beta); *************** *** 122,126 **** return null; } ! Vertex i = new Vertex("intersection"); // TODO Round off the point to be in the plane i.setX(x0 + t * xd); --- 122,126 ---- return null; } ! Vertex i = new Vertex(); // TODO Round off the point to be in the plane i.setX(x0 + t * xd); Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Project.java 12 Dec 2005 20:18:52 -0000 1.10 --- Project.java 19 Dec 2005 07:50:06 -0000 1.11 *************** *** 441,445 **** Iterator iter = vertices.iterator(); double limit = delta; ! Vertex tester = new Vertex("", x, y, z); while (iter.hasNext()) { Vertex current = (Vertex) iter.next(); --- 441,445 ---- Iterator iter = vertices.iterator(); double limit = delta; ! Vertex tester = new Vertex(x, y, z); while (iter.hasNext()) { Vertex current = (Vertex) iter.next(); Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Camera.java 15 Dec 2005 12:37:04 -0000 1.4 --- Camera.java 19 Dec 2005 07:50:06 -0000 1.5 *************** *** 246,255 **** */ public static void rotateHorizontallyEye(Camera c, double angle) { ! Vertex up = new Vertex("", c.roll[0], c.roll[1], c.roll[2]); up.scale(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.scale(1 / forward.length()); Geometry.rotate(angle, 0, 0, 1, c.center, c.camera); --- 246,255 ---- */ public static void rotateHorizontallyEye(Camera c, double angle) { ! Vertex up = new Vertex(c.roll[0], c.roll[1], c.roll[2]); up.scale(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.scale(1 / forward.length()); Geometry.rotate(angle, 0, 0, 1, c.center, c.camera); *************** *** 263,272 **** */ public static void rotateVerticallyEye(Camera c, double angle) { ! Vertex up = new Vertex("", c.roll[0], c.roll[1], c.roll[2]); up.scale(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.scale(1 / forward.length()); Vertex sidewards = up.cross(forward); --- 263,272 ---- */ public static void rotateVerticallyEye(Camera c, double angle) { ! Vertex up = new Vertex(c.roll[0], c.roll[1], c.roll[2]); up.scale(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.scale(1 / forward.length()); Vertex sidewards = up.cross(forward); *************** *** 302,311 **** */ public static void rotateVertically(Camera c, double angle, double[] center) { ! Vertex up = new Vertex("", c.roll[0], c.roll[1], c.roll[2]); //up.scale(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.scale(1 / forward.length()); Vertex sidewards = up.cross(forward); --- 302,311 ---- */ public static void rotateVertically(Camera c, double angle, double[] center) { ! Vertex up = new Vertex(c.roll[0], c.roll[1], c.roll[2]); //up.scale(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.scale(1 / forward.length()); Vertex sidewards = up.cross(forward); *************** *** 329,333 **** double y = c.center[1] - c.camera[1]; double z = c.center[2] - c.camera[2]; ! Vertex forward = new Vertex("", x, y, z); forward.scale(1 / forward.length()); Geometry.rotate(angle / 2, forward.getX(), --- 329,333 ---- double y = c.center[1] - c.camera[1]; double z = c.center[2] - c.camera[2]; ! Vertex forward = new Vertex(x, y, z); forward.scale(1 / forward.length()); Geometry.rotate(angle / 2, forward.getX(), Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Geometry.java 24 Nov 2005 13:50:22 -0000 1.6 --- Geometry.java 19 Dec 2005 07:50:06 -0000 1.7 *************** *** 256,260 **** current = currentEdge.other(current); } ! return new Surface("Clockwise Surface", result); } --- 256,260 ---- current = currentEdge.other(current); } ! return new Surface(result); } *************** *** 285,289 **** current = currentEdge.other(current); } ! return new Surface("Counterclockwise Surface", result); } --- 285,289 ---- current = currentEdge.other(current); } ! return new Surface(result); } Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Vertex.java 28 Nov 2005 22:23:49 -0000 1.16 --- Vertex.java 19 Dec 2005 07:50:05 -0000 1.17 *************** *** 29,34 **** private Long id; ! /** The name */ ! private String name; /** The x coordinate */ --- 29,33 ---- private Long id; ! /** The x coordinate */ *************** *** 41,64 **** private double z; - /** The w coordinate */ - private double w; - /** * Constructor for persistence layer */ ! Vertex() { ! } ! ! /** ! * Constructor ! * @param name The name ! */ ! public Vertex(String name) { ! super(); ! setName(name); ! setX(0.0); ! setY(0.0); ! setZ(0.0); ! setW(0.0); } --- 40,47 ---- private double z; /** * Constructor for persistence layer */ ! public Vertex() { } *************** *** 66,76 **** * * Constructor - * @param name The name * @param x The x * @param y The y * @param z The z */ ! public Vertex(String name, double x, double y, double z) { ! this(name); setX(x); setY(y); --- 49,57 ---- * * Constructor * @param x The x * @param y The y * @param z The z */ ! public Vertex(double x, double y, double z) { setX(x); setY(y); *************** *** 103,118 **** */ public String getName() { return name; } /** - * Set the name - * @param name The name - */ - public void setName(String name) { - this.name = name; - } - - /** * Get the x coordinate * @return The x coordinate --- 84,97 ---- */ public String getName() { + String name; + if (id != null) { + name = "V" + id; + } else { + name = "V"; + } return name; } /** * Get the x coordinate * @return The x coordinate *************** *** 164,186 **** this.z = z; } - - /** - * Get the w coordinate - * @return The w coordinate - * @hibernate.property - */ - public double getW() { - return w; - } - - /** - * Set the w coordinate - * @param w The w coordinate - */ - public void setW(double w) { - this.w = w; - } - /** * returns the edges connected to this vertex --- 143,147 ---- *************** *** 219,223 **** */ public Vertex copy() { ! Vertex vertex = new Vertex(getName()); vertex.setX(getX()); vertex.setY(getY()); --- 180,184 ---- */ public Vertex copy() { ! Vertex vertex = new Vertex(); vertex.setX(getX()); vertex.setY(getY()); *************** *** 242,246 **** */ public Vertex minus(Vertex v) { ! Vertex res = new Vertex("minus"); res.setX(this.getX() - v.getX()); res.setY(this.getY() - v.getY()); --- 203,207 ---- */ public Vertex minus(Vertex v) { ! Vertex res = new Vertex(); res.setX(this.getX() - v.getX()); res.setY(this.getY() - v.getY()); *************** *** 255,259 **** */ public Vertex add(Vertex v) { ! Vertex res = new Vertex("add"); res.setX(this.getX() + v.getX()); res.setY(this.getY() + v.getY()); --- 216,220 ---- */ public Vertex add(Vertex v) { ! Vertex res = new Vertex(); res.setX(this.getX() + v.getX()); res.setY(this.getY() + v.getY()); *************** *** 268,272 **** */ public Vertex cross(Vertex v) { ! Vertex cross = new Vertex("cross"); cross.setX(this.getY() * v.getZ() - v.getY() * this.getZ()); cross.setY(this.getZ() * v.getX() - v.getZ() * this.getX()); --- 229,233 ---- */ public Vertex cross(Vertex v) { ! Vertex cross = new Vertex(); cross.setX(this.getY() * v.getZ() - v.getY() * this.getZ()); cross.setY(this.getZ() * v.getX() - v.getZ() * this.getX()); *************** *** 385,390 **** */ public String toString() { ! return "Vertex[id=" + id + ",name=" + name + ",x=" + x + ",y=" + y + ! ",z=" + z + ",w=" + w + "]"; } } --- 346,351 ---- */ public String toString() { ! return getName() + "[" + x + ", " + y + ! ", " + z + "]"; } } |
From: Michael L. <he...@us...> - 2005-12-19 07:50:16
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6368/src/net/sourceforge/bprocessor/model/xml Modified Files: PersistenceManager.java Log Message: Name removed Surface, Edge, and Vertex Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PersistenceManager.java 11 Dec 2005 17:50:30 -0000 1.14 --- PersistenceManager.java 19 Dec 2005 07:50:06 -0000 1.15 *************** *** 175,179 **** net.sourceforge.bprocessor.model.Surface sm = ! new net.sourceforge.bprocessor.model.Surface(s.getName()); sm.setConstructor(s.isConstructor()); --- 175,179 ---- net.sourceforge.bprocessor.model.Surface sm = ! new net.sourceforge.bprocessor.model.Surface(); sm.setConstructor(s.isConstructor()); *************** *** 198,202 **** net.sourceforge.bprocessor.model.Edge em = ! new net.sourceforge.bprocessor.model.Edge(e.getName()); em.setConstructor(e.isConstructor()); --- 198,202 ---- net.sourceforge.bprocessor.model.Edge em = ! new net.sourceforge.bprocessor.model.Edge(); em.setConstructor(e.isConstructor()); *************** *** 219,228 **** net.sourceforge.bprocessor.model.Vertex vm = ! new net.sourceforge.bprocessor.model.Vertex(v.getName()); vm.setX(v.getX()); vm.setY(v.getY()); vm.setZ(v.getZ()); - vm.setW(v.getW()); Project.getInstance().intern(vm); --- 219,227 ---- net.sourceforge.bprocessor.model.Vertex vm = ! new net.sourceforge.bprocessor.model.Vertex(); vm.setX(v.getX()); vm.setY(v.getY()); vm.setZ(v.getZ()); Project.getInstance().intern(vm); *************** *** 613,617 **** vx.setY(v.getY()); vx.setZ(v.getZ()); - vx.setW(v.getW()); Map vm = (Map)mapper.get(KEY_VERTEX); --- 612,615 ---- |
From: Michael L. <he...@us...> - 2005-12-16 15:53:48
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31491/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Fixed bug in Surface.surrounds() Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** Surface.java 12 Dec 2005 20:18:52 -0000 1.54 --- Surface.java 16 Dec 2005 15:53:34 -0000 1.55 *************** *** 283,286 **** --- 283,289 ---- getEdges().toArray(edges); + // FIXME Generalize to + // replace one edge with list of edges. + for (int i = 0; i < edges.length; i++) { Edge current = edges[i]; *************** *** 862,873 **** this surface */ - if (lv.getZ() > planePrecision || -lv.getZ() > planePrecision) { return false; } else { ! /* ! The crossing numbers algorithm but simplyfied by translating ! points to the local coordinates of the surface plane. ! */ Iterator ei = edges.iterator(); int count = 0; --- 865,875 ---- this surface */ if (lv.getZ() > planePrecision || -lv.getZ() > planePrecision) { return false; } else { ! // Crossing numbers algorithm in 2d by translating to plane ! // TODO a cheaper way to translate is to discard a component of the vertices ! // Ñ the component that corresponds to the component of the normal with largest ! // absolute value to ensure that the translated surface has a non-zero area. Iterator ei = edges.iterator(); int count = 0; *************** *** 877,891 **** Vertex f = cs.translate(e.getFrom()); boolean cross = false; ! if (t.getY() > lv.getY() && ! f.getY() < lv.getY()) { cross = true; ! } else if (t.getY() < lv.getY() && ! f.getY() > lv.getY()) { cross = true; } ! /* ! Making sure only to count crossings to the right ! of v. ! */ if (cross) { Vertex dir = t.minus(f); --- 879,892 ---- Vertex f = cs.translate(e.getFrom()); boolean cross = false; ! if (f.getY() <= lv.getY() && ! lv.getY() < t.getY()) { cross = true; ! } else if (t.getY() <= lv.getY() && ! lv.getY() < f.getY()) { cross = true; } ! ! // Making sure only to count crossings to the right ! // of v if (cross) { Vertex dir = t.minus(f); *************** *** 896,899 **** --- 897,901 ---- cross = (pstar > 0); } + } if (cross) { *************** *** 901,904 **** --- 903,907 ---- } } + return !(count % 2 == 0); } |
From: rimestad <rim...@us...> - 2005-12-15 13:03:04
|
Update of /cvsroot/bprocessor/build/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2929/doc Modified Files: README Log Message: Added keycodes for walk and fly Index: README =================================================================== RCS file: /cvsroot/bprocessor/build/doc/README,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** README 15 Dec 2005 12:37:08 -0000 1.8 --- README 15 Dec 2005 13:02:51 -0000 1.9 *************** *** 32,35 **** --- 32,37 ---- E : Extrude R : Rotation tool + SHIFT W : Walk mode + SHIFT F : Fly mode UP : Camera up |
From: rimestad <rim...@us...> - 2005-12-15 13:03:03
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2883/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java Log Message: Added keycodes for walk and fly Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** AbstractTool.java 15 Dec 2005 12:37:00 -0000 1.38 --- AbstractTool.java 15 Dec 2005 13:02:47 -0000 1.39 *************** *** 149,188 **** public void keyPressed(KeyEvent e) { Camera c = glv.getView().getCamera(); ! if (e.getKeyCode() == KeyEvent.VK_UP) { ! c.translate(new double[] {0.0, -1.0, 0.0}); ! } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { ! c.translate(new double[] {0.0, 1.0, 0.0}); ! } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { ! c.translate(new double[] {-1.0, 0.0, 0.0}); ! } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { ! c.translate(new double[] {1.0, 0.0, 0.0}); ! } else if (e.getKeyCode() == KeyEvent.VK_Z) { ! c.zoomout(); ! } else if (e.getKeyCode() == KeyEvent.VK_X) { ! c.zoomin(); ! } else if (e.getKeyCode() == KeyEvent.VK_Q) { ! glv.changeTool(Tool.SELECT_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_W) { ! glv.changeTool(Tool.PENCIL_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_M) { ! glv.changeTool(Tool.MOVE_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_R) { ! glv.changeTool(Tool.ROTATION_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_E) { ! glv.changeTool(Tool.EXTRUSION_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_F1) { ! glv.changeCamera(Camera.create(Camera.VIEW_3D)); ! } else if (e.getKeyCode() == KeyEvent.VK_F2) { ! glv.changeCamera(Camera.create(Camera.VIEW_XZ)); ! } else if (e.getKeyCode() == KeyEvent.VK_F3) { ! glv.changeCamera(Camera.create(Camera.VIEW_XY)); ! } else if (e.getKeyCode() == KeyEvent.VK_F4) { ! glv.changeCamera(Camera.create(Camera.VIEW_YZ)); ! } else if (e.getKeyCode() == KeyEvent.VK_F5) { ! glv.getView().changeDrawMode(View.WIREFRAME_MODE); ! } else if (e.getKeyCode() == KeyEvent.VK_F6) { ! glv.getView().changeDrawMode(View.SOLID_MODE); ! } else if (e.getKeyCode() == KeyEvent.VK_F7) { ! glv.getView().changeDrawMode(View.LIGHTING_MODE); } glv.repaint(true); --- 149,197 ---- public void keyPressed(KeyEvent e) { Camera c = glv.getView().getCamera(); ! if ((e.getModifiersEx() & KeyEvent.SHIFT_DOWN_MASK) == KeyEvent.SHIFT_DOWN_MASK) { ! // IF SHIFT IS PRESSED AS MODIFIER ! if (e.getKeyCode() == KeyEvent.VK_W) { ! glv.changeTool(Tool.WALK_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_F) { ! glv.changeTool(Tool.FLY_TOOL); ! } ! } else { ! if (e.getKeyCode() == KeyEvent.VK_UP) { ! c.translate(new double[] {0.0, -1.0, 0.0}); ! } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { ! c.translate(new double[] {0.0, 1.0, 0.0}); ! } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { ! c.translate(new double[] {-1.0, 0.0, 0.0}); ! } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { ! c.translate(new double[] {1.0, 0.0, 0.0}); ! } else if (e.getKeyCode() == KeyEvent.VK_Z) { ! c.zoomout(); ! } else if (e.getKeyCode() == KeyEvent.VK_X) { ! c.zoomin(); ! } else if (e.getKeyCode() == KeyEvent.VK_Q) { ! glv.changeTool(Tool.SELECT_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_W) { ! glv.changeTool(Tool.PENCIL_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_M) { ! glv.changeTool(Tool.MOVE_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_R) { ! glv.changeTool(Tool.ROTATION_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_E) { ! glv.changeTool(Tool.EXTRUSION_TOOL); ! } else if (e.getKeyCode() == KeyEvent.VK_F1) { ! glv.changeCamera(Camera.create(Camera.VIEW_3D)); ! } else if (e.getKeyCode() == KeyEvent.VK_F2) { ! glv.changeCamera(Camera.create(Camera.VIEW_XZ)); ! } else if (e.getKeyCode() == KeyEvent.VK_F3) { ! glv.changeCamera(Camera.create(Camera.VIEW_XY)); ! } else if (e.getKeyCode() == KeyEvent.VK_F4) { ! glv.changeCamera(Camera.create(Camera.VIEW_YZ)); ! } else if (e.getKeyCode() == KeyEvent.VK_F5) { ! glv.getView().changeDrawMode(View.WIREFRAME_MODE); ! } else if (e.getKeyCode() == KeyEvent.VK_F6) { ! glv.getView().changeDrawMode(View.SOLID_MODE); ! } else if (e.getKeyCode() == KeyEvent.VK_F7) { ! glv.getView().changeDrawMode(View.LIGHTING_MODE); ! } } glv.repaint(true); |
From: rimestad <rim...@us...> - 2005-12-15 12:38:14
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30453/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: clipping planes use alpha and the depth buffer now uses <= and not < Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** View.java 14 Dec 2005 14:36:17 -0000 1.31 --- View.java 15 Dec 2005 12:38:06 -0000 1.32 *************** *** 91,95 **** /** Used for clipping planes */ ! public static final float[] CLIP_PLANE_COLOR = new float[] {1.0f, 0.65f, 0.0f}; /** Used for target objects */ --- 91,95 ---- /** Used for clipping planes */ ! public static final float[] CLIP_PLANE_COLOR = new float[] {1.0f, 0.65f, 0.0f, 0.3f}; /** Used for target objects */ *************** *** 99,102 **** --- 99,111 ---- public static final float [] CONSTRUCTOR_COLOR = new float[] {0.8f, 0.7f, 0.6f, 0.50f}; + /** Front color for surfaces */ + protected static float[] frontCcolor = new float[] {0.96f, 0.87f, 0.70f}; + + /** NONE color for surfaces */ + protected static float[] noneColor = new float[] {0.70f, 0.70f, 0.70f}; + + /** Back color for surfaces */ + protected static float[] backColor = new float[] {0.94f, 0.97f, 1.00f}; + /** Select mode for selecting edges */ private static final int EDGES = 0; *************** *** 133,137 **** /** The size of the viewing area */ ! protected static double size = 25.0; /** The Active edge */ --- 142,146 ---- /** The size of the viewing area */ ! protected static double gridSize = 25.0; /** The Active edge */ *************** *** 171,186 **** /** The current constructor color */ protected static float[] constructorColor; - - /** Front color for surfaces */ - protected static float[] frontCcolor = new float[] {0.96f, 0.87f, 0.70f}; - - /** NONE color for surfaces */ - protected static float[] noneColor = new float[] {0.70f, 0.70f, 0.70f}; - - /** Back color for surfaces */ - protected static float[] backColor = new float[] {0.94f, 0.97f, 1.00f}; /** The target */ - protected static Object target = null; --- 180,185 ---- *************** *** 390,395 **** gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); ! //gl.glDepthMask(true); ! gl.glEnable(GL.GL_COLOR_MATERIAL); gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE); --- 389,395 ---- gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); ! gl.glDepthMask(true); ! gl.glDepthFunc(GL.GL_LEQUAL); ! gl.glEnable(GL.GL_COLOR_MATERIAL); gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE); *************** *** 424,446 **** // grid and coords are always completely lit - gl.glDisable(GL.GL_DEPTH_TEST); gl.glLineWidth(1.0f); grid(); - gl.glLineWidth(1.0f); - gl.glEnable(GL.GL_DEPTH_TEST); - gl.glDepthFunc(GL.GL_LESS); coords(); - - // draw the clipping planes - Iterator clipit = clippingPlanes.iterator(); - gl.glEnable(GL.GL_POLYGON_STIPPLE); - gl.glPolygonStipple(highlight); - while (clipit.hasNext()) { - ClippingPlane cp = (ClippingPlane)clipit.next(); - drawClipplane(cp); - } - gl.glDisable(GL.GL_POLYGON_STIPPLE); ! clipit = clippingPlanes.iterator(); while (clipit.hasNext()) { ClippingPlane cp = (ClippingPlane)clipit.next(); --- 424,432 ---- // grid and coords are always completely lit gl.glLineWidth(1.0f); grid(); coords(); ! Iterator clipit = clippingPlanes.iterator(); while (clipit.hasNext()) { ClippingPlane cp = (ClippingPlane)clipit.next(); *************** *** 452,455 **** --- 438,442 ---- gl.glLineWidth(1.0f); drawAll(gld); + gl.glEnable(GL.GL_DEPTH_TEST); clipit = clippingPlanes.iterator(); *************** *** 458,462 **** gl.glDisable(GL.GL_CLIP_PLANE0 + cp.getNumber()); } ! gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); --- 445,456 ---- gl.glDisable(GL.GL_CLIP_PLANE0 + cp.getNumber()); } ! ! clipit = clippingPlanes.iterator(); ! while (clipit.hasNext()) { ! ClippingPlane cp = (ClippingPlane)clipit.next(); ! // draw the clipping planes ! drawClipplane(cp); ! } ! gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); *************** *** 1074,1078 **** Collection corners = clipplane.getCorners(); { ! gl.glColor3fv(CLIP_PLANE_COLOR); gl.glBegin(GL.GL_QUADS); gl.glNormal3d(d[0], d[1], d[2]); --- 1068,1072 ---- Collection corners = clipplane.getCorners(); { ! gl.glColor4fv(CLIP_PLANE_COLOR); gl.glBegin(GL.GL_QUADS); gl.glNormal3d(d[0], d[1], d[2]); *************** *** 2072,2076 **** */ protected void grid() { ! double size = this.size; if (aspect > 1) { size *= aspect; --- 2066,2070 ---- */ protected void grid() { ! double size = View.gridSize; if (aspect > 1) { size *= aspect; *************** *** 2079,2092 **** } gl.glColor4fv(gridColor); gl.glBegin(GL.GL_LINES); size /= 2; for (int x = -(int)size; x <= (int)size; x++) { ! gl.glVertex3d((double) x * 2, -size * 2, -0.01); ! gl.glVertex3d((double) x * 2, size * 2, -0.01); } for (int y = -(int)size; y <= (int)size; y++) { ! gl.glVertex3d(-size * 2, (double) y * 2, -0.01); ! gl.glVertex3d(size * 2, (double) y * 2, -0.01); } gl.glEnd(); --- 2073,2087 ---- } gl.glColor4fv(gridColor); + gl.glDisable(GL.GL_DEPTH_TEST); gl.glBegin(GL.GL_LINES); size /= 2; for (int x = -(int)size; x <= (int)size; x++) { ! gl.glVertex3d((double) x * 2, -size * 2, 0); ! gl.glVertex3d((double) x * 2, size * 2, 0); } for (int y = -(int)size; y <= (int)size; y++) { ! gl.glVertex3d(-size * 2, (double) y * 2, 0); ! gl.glVertex3d(size * 2, (double) y * 2, 0); } gl.glEnd(); *************** *** 2097,2101 **** */ protected void coords() { ! double size = View.size; if (aspect > 1) { size *= aspect; --- 2092,2096 ---- */ protected void coords() { ! double size = View.gridSize; if (aspect > 1) { size *= aspect; *************** *** 2104,2107 **** --- 2099,2103 ---- } gl.glBegin(GL.GL_LINES); + gl.glDisable(GL.GL_DEPTH_TEST); gl.glColor3fv(X_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); *************** *** 2110,2113 **** --- 2106,2112 ---- gl.glVertex3d(0.0, 0.0, 0.0); gl.glVertex3d(0.0, size, 0.0); + gl.glEnd(); + gl.glEnable(GL.GL_DEPTH_TEST); + gl.glBegin(GL.GL_LINES); gl.glColor3fv(Z_AXIS_COLOR); gl.glVertex3d(0.0, 0.0, 0.0); |
From: rimestad <rim...@us...> - 2005-12-15 12:37:16
|
Update of /cvsroot/bprocessor/build/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30305/doc Modified Files: README Log Message: Added working walk and fly tool along with changes to zoom so that far clipping is better and it is still possible to draw really small Index: README =================================================================== RCS file: /cvsroot/bprocessor/build/doc/README,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** README 18 Nov 2005 01:48:41 -0000 1.7 --- README 15 Dec 2005 12:37:08 -0000 1.8 *************** *** 38,41 **** --- 38,43 ---- RIGHT : Camera right + Drag by holding the middle mouse button (button2) and moving the mouse + Z : Zoom in X : Zoom out *************** *** 62,69 **** <-- ROTATION --> SHIFT (held down) : roll the camera ! mouse drag (button 1) rotate (works in all tools) ! button 2 drag like arrow keys ! Homepage: --------- --- 64,79 ---- <-- ROTATION --> + mouse drag with button1 rotate the camera about center point SHIFT (held down) : roll the camera ! ALT (held down) : rotate about eye position ! if mouse button3 is pressed the previous tool is selected ! ! <-- FLY --> ! move after the looking direction directed with the mouse by dragging (use left mouse button) and fly forward ! backward with UP/DOWN keys and strafe left right with LEFT/RIGHT keys ! ! <-- WALK --> ! Move en the plane where the camera is placed, by the same keys as fly ! Homepage: --------- |
From: rimestad <rim...@us...> - 2005-12-15 12:37:12
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30285/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Log Message: Added working walk and fly tool along with changes to zoom so that far clipping is better and it is still possible to draw really small Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Camera.java 14 Dec 2005 14:20:39 -0000 1.3 --- Camera.java 15 Dec 2005 12:37:04 -0000 1.4 *************** *** 224,230 **** */ public void zoomin(double[] target) { ! camera[0] -= (camera[0] - target[0]) * 0.1; ! camera[1] -= (camera[1] - target[1]) * 0.1; ! camera[2] -= (camera[2] - target[2]) * 0.1; } --- 224,232 ---- */ public void zoomin(double[] target) { ! if (dist() >= 0.1) { ! camera[0] -= (camera[0] - target[0]) * 0.1; ! camera[1] -= (camera[1] - target[1]) * 0.1; ! camera[2] -= (camera[2] - target[2]) * 0.1; ! } } |
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30255/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java CameraFlyTool.java AbstractTool.java ToolFactory.java CameraTool.java Added Files: CameraWalkTool.java Log Message: Added working walk and fly tool along with changes to zoom so that far clipping is better and it is still possible to draw really small Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Tool.java 14 Dec 2005 14:20:34 -0000 1.15 --- Tool.java 15 Dec 2005 12:37:00 -0000 1.16 *************** *** 36,39 **** --- 36,41 ---- /** The Fly tool */ public static final int FLY_TOOL = 7; + /** The walk tool */ + public static final int WALK_TOOL = 8; /** Index: CameraTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraTool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CameraTool.java 14 Dec 2005 14:20:34 -0000 1.5 --- CameraTool.java 15 Dec 2005 12:37:00 -0000 1.6 *************** *** 10,15 **** import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Camera; - import net.sourceforge.bprocessor.model.Plane; - import net.sourceforge.bprocessor.model.Vertex; //import java.awt.event.KeyEvent; --- 10,13 ---- *************** *** 39,55 **** private Cursor rotationCursor; - /** The cursor for drag */ - private Cursor dragCursor; - /** * KeyListener for the GL Canvas * @param glv The 3D canvas * @param cursor1 The Mouse cursor for rotation - * @param cursor2 The Mouse cursor for drag */ ! public CameraTool(GLView glv, Cursor cursor1, Cursor cursor2) { super(glv, cursor1); rotationCursor = cursor1; - dragCursor = cursor2; } --- 37,48 ---- private Cursor rotationCursor; /** * KeyListener for the GL Canvas * @param glv The 3D canvas * @param cursor1 The Mouse cursor for rotation */ ! public CameraTool(GLView glv, Cursor cursor1) { super(glv, cursor1); rotationCursor = cursor1; } *************** *** 73,102 **** View view = glv.getView(); Camera c = view.getCamera(); - double[] center = c.getCenter(); - double[] camera = c.getCamera(); double[] roll = c.getRoll(); ! if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || ! e.getButton() == MouseEvent.BUTTON2) { ! glv.setCursor(dragCursor); ! ! double x = camera[0] - center[0]; ! double y = camera[1] - center[1]; ! double z = camera[2] - center[2]; ! double sqr = Math.sqrt(x * x + y * y + z * z); ! if (sqr < 1) { ! x *= 1 / sqr; ! y *= 1 / sqr; ! z *= 1 / sqr; ! } ! Vertex first = view.toPlaneCoords(new double[] {previousPos[0], ! previousPos[1]}, ! new Plane(x, y, z, 0)); ! Vertex second = view.toPlaneCoords(new double[] {e.getX(), ! e.getY()}, ! new Plane(x, y, z, 0)); ! c.translate(new double[] {first.getX() - second.getX(), ! first.getY() - second.getY(), ! first.getZ() - second.getZ()}); ! } else if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK || e.getButton() == MouseEvent.BUTTON1) { double angleX = ((double)(e.getX() - previousPos[0]) / 360) * Math.PI; --- 66,71 ---- View view = glv.getView(); Camera c = view.getCamera(); double[] roll = c.getRoll(); ! if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK || e.getButton() == MouseEvent.BUTTON1) { double angleX = ((double)(e.getX() - previousPos[0]) / 360) * Math.PI; Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ToolFactory.java 14 Dec 2005 14:20:34 -0000 1.19 --- ToolFactory.java 15 Dec 2005 12:37:00 -0000 1.20 *************** *** 55,58 **** --- 55,61 ---- private CameraFlyTool fly; + /** Camera walktool */ + private CameraWalkTool walk; + /** Tape measure tool */ private TapeMeasureTool tapeMeasure; *************** *** 79,90 **** Cursor rotationCursor = Toolkit.getDefaultToolkit().createCustomCursor(rotationImage, new Point(7, 8), "Rotation"); - url = cl.getResource("Bicondrag.gif"); - Image dragImage = Toolkit.getDefaultToolkit().getImage(url); - Cursor dragCursor = - Toolkit.getDefaultToolkit().createCustomCursor(dragImage, new Point(7, 8), "Drag"); url = cl.getResource("Biconfly.gif"); Image flyImage = Toolkit.getDefaultToolkit().getImage(url); Cursor flyCursor = Toolkit.getDefaultToolkit().createCustomCursor(flyImage, new Point(7, 8), "Fly"); Toolbar tb = Toolbar.getInstance(); --- 82,93 ---- Cursor rotationCursor = Toolkit.getDefaultToolkit().createCustomCursor(rotationImage, new Point(7, 8), "Rotation"); url = cl.getResource("Biconfly.gif"); Image flyImage = Toolkit.getDefaultToolkit().getImage(url); Cursor flyCursor = Toolkit.getDefaultToolkit().createCustomCursor(flyImage, new Point(7, 8), "Fly"); + url = cl.getResource("Biconwalk.gif"); + Image walkImage = Toolkit.getDefaultToolkit().getImage(url); + Cursor walkCursor = + Toolkit.getDefaultToolkit().createCustomCursor(walkImage, new Point(7, 8), "Walk"); Toolbar tb = Toolbar.getInstance(); *************** *** 101,108 **** but = tb.registerAction(new RotationAction(glv)); but.setToolTipText("Rotation"); - but = tb.registerAction(new TapeMeasureAction(glv)); - but.setToolTipText("Tape Measure"); but = tb.registerAction(new CameraFlyAction(glv)); but.setToolTipText("Fly mode"); --- 104,114 ---- but = tb.registerAction(new RotationAction(glv)); but.setToolTipText("Rotation"); but = tb.registerAction(new CameraFlyAction(glv)); but.setToolTipText("Fly mode"); + but = tb.registerAction(new CameraWalkAction(glv)); + but.setToolTipText("Walk mode"); + but = tb.registerAction(new TapeMeasureAction(glv)); + but.setToolTipText("Tape Measure"); + *************** *** 112,118 **** extrusion = new ExtrusionTool(glv, pencilcursor); clipplane = new ClipplaneTool(glv, pencilcursor); ! rotation = new CameraTool(glv, rotationCursor, dragCursor); tapeMeasure = new TapeMeasureTool(glv, pencilcursor); fly = new CameraFlyTool(glv, flyCursor); Notifier.getInstance().addListener(select); --- 118,125 ---- extrusion = new ExtrusionTool(glv, pencilcursor); clipplane = new ClipplaneTool(glv, pencilcursor); ! rotation = new CameraTool(glv, rotationCursor); tapeMeasure = new TapeMeasureTool(glv, pencilcursor); fly = new CameraFlyTool(glv, flyCursor); + walk = new CameraWalkTool(glv, walkCursor); Notifier.getInstance().addListener(select); *************** *** 178,181 **** --- 185,191 ---- currentTool = fly; return fly; + } else if (i == Tool.WALK_TOOL) { + currentTool = walk; + return walk; } else if (i == Tool.TAPE_MEASURE_TOOL) { currentTool = tapeMeasure; *************** *** 246,250 **** /** ! * The rotation action inner class */ class CameraFlyAction extends AbstractAction { --- 256,260 ---- /** ! * The fly action inner class */ class CameraFlyAction extends AbstractAction { *************** *** 272,275 **** --- 282,313 ---- } } + + /** + * The walk action inner class + */ + class CameraWalkAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + CameraWalkAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("Biconwalk.gif"); + ImageIcon im = new ImageIcon(url); + putValue(Action.SMALL_ICON, im); + } + + /** + * Called when the button is pressed + * @param e The ActionEvent + */ + public void actionPerformed(ActionEvent e) { + glv.changeTool(Tool.WALK_TOOL); + } + } /** Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** AbstractTool.java 14 Dec 2005 14:22:43 -0000 1.37 --- AbstractTool.java 15 Dec 2005 12:37:00 -0000 1.38 *************** *** 9,12 **** --- 9,13 ---- import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; *************** *** 16,23 **** --- 17,28 ---- import java.awt.Cursor; + import java.awt.Image; + import java.awt.Point; + import java.awt.Toolkit; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; + import java.net.URL; import java.util.List; import java.util.Iterator; *************** *** 70,74 **** protected Cursor cursor; ! static { selection = new HashSet(); --- 75,81 ---- protected Cursor cursor; ! /** The cursor for drag */ ! private Cursor dragCursor; ! static { selection = new HashSet(); *************** *** 83,86 **** --- 90,98 ---- this.glv = glv; this.cursor = cursor; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("Bicondrag.gif"); + Image dragImage = Toolkit.getDefaultToolkit().getImage(url); + dragCursor = + Toolkit.getDefaultToolkit().createCustomCursor(dragImage, new Point(7, 8), "Drag"); } *************** *** 202,206 **** AbstractTool.dy = y - pressPos[1]; ! dragged(e); previousPos[0] = x; --- 214,244 ---- AbstractTool.dy = y - pressPos[1]; ! if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || ! e.getButton() == MouseEvent.BUTTON2) { ! View view = glv.getView(); ! Camera c = view.getCamera(); ! double[] center = c.getCenter(); ! double[] camera = c.getCamera(); ! double dx = camera[0] - center[0]; ! double dy = camera[1] - center[1]; ! double dz = camera[2] - center[2]; ! double sqr = Math.sqrt(dx * dx + dy * dy + dz * dz); ! if (sqr < 1) { ! dx *= 1 / sqr; ! dy *= 1 / sqr; ! dz *= 1 / sqr; ! } ! Vertex first = view.toPlaneCoords(new double[] {previousPos[0], ! previousPos[1]}, ! new Plane(dx, dy, dz, 0)); ! Vertex second = view.toPlaneCoords(new double[] {e.getX(), ! e.getY()}, ! new Plane(dx, dy, dz, 0)); ! c.translate(new double[] {first.getX() - second.getX(), ! first.getY() - second.getY(), ! first.getZ() - second.getZ()}); ! } else { ! dragged(e); ! } previousPos[0] = x; *************** *** 261,265 **** if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! glv.changeTool(Tool.ROTATION_TOOL); } else { pressed(e); --- 299,303 ---- if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! glv.setCursor(dragCursor); } else { pressed(e); *************** *** 273,280 **** */ public void mouseReleased(MouseEvent e) { - int currentButton = e.getButton(); if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! glv.changeTool(Tool.PREVIOUS_TOOL); } else { released(e); --- 311,317 ---- */ public void mouseReleased(MouseEvent e) { if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! glv.setCursor(cursor); } else { released(e); --- NEW FILE: CameraWalkTool.java --- //--------------------------------------------------------------------------------- // $Id: CameraWalkTool.java,v 1.1 2005/12/15 12:37:00 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Vertex; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.Cursor; import org.apache.log4j.Logger; /** * The camera fly tool */ public class CameraWalkTool extends AbstractTool { /** The logger */ private static Logger log = Logger.getLogger(CameraWalkTool.class); /** * Constructor * @param glv The 3D canvas * @param cursor the cursor */ public CameraWalkTool(GLView glv, Cursor cursor) { super(glv, cursor); } /** * Invoked when the mouse cursor has been moved * @param e The MouseEvent object */ protected void moved(MouseEvent e) { } /** * Invoked when the mouse is held pressed and moved * @param e The MouseEvent object */ protected void dragged(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 || (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK) { Camera c = glv.getView().getCamera(); double angleX = ((double)(e.getX() - previousPos[0]) / 360) * Math.PI; double angleY = ((double)(e.getY() - previousPos[1]) / 360) * Math.PI; Camera.rotateHorizontallyEye(c, -angleX); Camera.rotateVerticallyEye(c, angleY); } } /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ protected void pressed(MouseEvent e) { } /** * Invoked when a mouse button has been released on a component. * @param e The MouseEvent */ protected void released(MouseEvent e) { } /** * Invoked when a key has been pressed. Lets user control the speed * and mode of movement. * @param e The KeyEvent */ public void keyPressed(KeyEvent e) { Camera c = glv.getView().getCamera(); Vertex up = new Vertex("", c.getRoll()[0], c.getRoll()[1], c.getRoll()[2]); double x = c.getCenter()[0] - c.getCamera()[0]; double y = c.getCenter()[1] - c.getCamera()[1]; double z = c.getCenter()[2] - c.getCamera()[2]; Vertex forward = new Vertex("", x, y, z); forward.scale(2 / forward.length()); Vertex sidewards = up.cross(forward); sidewards.scale(2 / sidewards.length()); if (e.getKeyCode() == KeyEvent.VK_UP) { c.translate(new double[] {forward.getX(), forward.getY(), 0}); } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { c.translate(new double[] {-forward.getX(), -forward.getY(), 0}); } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { c.translate(new double[] {sidewards.getX(), sidewards.getY(), 0}); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { c.translate(new double[] {-sidewards.getX(), -sidewards.getY(), 0}); } else { super.keyPressed(e); } glv.repaint(true); } } Index: CameraFlyTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraFlyTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CameraFlyTool.java 14 Dec 2005 14:20:34 -0000 1.2 --- CameraFlyTool.java 15 Dec 2005 12:37:00 -0000 1.3 *************** *** 80,86 **** double z = c.getCenter()[2] - c.getCamera()[2]; Vertex forward = new Vertex("", x, y, z); ! forward.scale(1 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scale(1 / sidewards.length()); if (e.getKeyCode() == KeyEvent.VK_UP) { --- 80,86 ---- double z = c.getCenter()[2] - c.getCamera()[2]; Vertex forward = new Vertex("", x, y, z); ! forward.scale(2 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scale(2 / sidewards.length()); if (e.getKeyCode() == KeyEvent.VK_UP) { |
From: rimestad <rim...@us...> - 2005-12-14 14:36:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21548/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: fixed far clipping plane Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** View.java 14 Dec 2005 14:20:35 -0000 1.30 --- View.java 14 Dec 2005 14:36:17 -0000 1.31 *************** *** 2033,2037 **** --- 2033,2039 ---- (eye[2] - center[2]) * (eye[2] - center[2])); double near = length / 10; + near = near > 1 ? near = 1 : near; double far = length * 100.0; + far = far < 20 ? far = 20 : far; double focalwidth = camera.getFocalwidth(); if (aspect < 1.0) { |
From: rimestad <rim...@us...> - 2005-12-14 14:22:57
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19030/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java Log Message: Woops Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** AbstractTool.java 14 Dec 2005 14:20:34 -0000 1.36 --- AbstractTool.java 14 Dec 2005 14:22:43 -0000 1.37 *************** *** 9,13 **** import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Edge; - import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; --- 9,12 ---- *************** *** 101,112 **** int rotation = e.getWheelRotation(); Camera cam = (glv.getView()).getCamera(); - /*double[] camera = cam.getCamera(); - double[] center = cam.getCenter(); - double x = camera[0] - center[0]; - double y = camera[1] - center[1]; - double z = camera[2] - center[2]; - Vertex v = glv.getView().toPlaneCoords(new double[] {e.getX(), - e.getY()}, - new Plane(x, y, z, 0));*/ if (rotation > 0) { cam.zoomout(); --- 100,103 ---- |
From: rimestad <rim...@us...> - 2005-12-14 14:20:50
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18527/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Log Message: made small fixes and improvements to the camera tool and added a flytool Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Camera.java 13 Dec 2005 12:37:15 -0000 1.2 --- Camera.java 14 Dec 2005 14:20:39 -0000 1.3 *************** *** 216,222 **** */ public void zoomin() { ! camera[0] -= (camera[0] - center[0]) * 0.1; ! camera[1] -= (camera[1] - center[1]) * 0.1; ! camera[2] -= (camera[2] - center[2]) * 0.1; } --- 216,230 ---- */ public void zoomin() { ! zoomin(center); ! } ! ! /** ! * Function to zoom in ! * @param target The point to zoom towards ! */ ! public void zoomin(double[] target) { ! camera[0] -= (camera[0] - target[0]) * 0.1; ! camera[1] -= (camera[1] - target[1]) * 0.1; ! camera[2] -= (camera[2] - target[2]) * 0.1; } *************** *** 243,252 **** Vertex forward = new Vertex("", x, y, z); forward.scale(1 / forward.length()); ! double turn = 1; ! if (c.roll[2] < 0) { ! turn = -1; ! } ! Geometry.rotate(angle, up.getX(), up.getY(), up.getZ(), c.center, c.camera); ! Geometry.rotate(angle, 0, 0, turn, c.roll, new double[]{0, 0, 0}); } --- 251,256 ---- Vertex forward = new Vertex("", x, y, z); forward.scale(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}); } |
From: rimestad <rim...@us...> - 2005-12-14 14:20:46
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18470/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java CameraFlyTool.java AbstractTool.java ToolFactory.java CameraTool.java Log Message: made small fixes and improvements to the camera tool and added a flytool Index: CameraTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CameraTool.java 13 Dec 2005 12:37:20 -0000 1.4 --- CameraTool.java 14 Dec 2005 14:20:34 -0000 1.5 *************** *** 80,93 **** glv.setCursor(dragCursor); Vertex first = view.toPlaneCoords(new double[] {previousPos[0], previousPos[1]}, ! new Plane((camera[0] - center[0]), ! (camera[1] - center[1]), ! (camera[2] - center[2]), 0)); Vertex second = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, ! new Plane((camera[0] - center[0]), ! (camera[1] - center[1]), ! (camera[2] - center[2]), 0)); c.translate(new double[] {first.getX() - second.getX(), first.getY() - second.getY(), --- 80,98 ---- glv.setCursor(dragCursor); + double x = camera[0] - center[0]; + double y = camera[1] - center[1]; + double z = camera[2] - center[2]; + double sqr = Math.sqrt(x * x + y * y + z * z); + if (sqr < 1) { + x *= 1 / sqr; + y *= 1 / sqr; + z *= 1 / sqr; + } Vertex first = view.toPlaneCoords(new double[] {previousPos[0], previousPos[1]}, ! new Plane(x, y, z, 0)); Vertex second = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, ! new Plane(x, y, z, 0)); c.translate(new double[] {first.getX() - second.getX(), first.getY() - second.getY(), *************** *** 107,116 **** } else if (e.isAltDown()) { // rotate camera about itself ! Camera.rotateHorizontallyEye(c, angleX); ! Camera.rotateVerticallyEye(c, -angleY); } else { // rotate camera about point of view (or selection if any) ! Camera.rotateHorizontally(c, -angleX, center); ! Camera.rotateVertically(c, angleY, center); } glv.repaint(); --- 112,122 ---- } else if (e.isAltDown()) { // rotate camera about itself ! Camera.rotateHorizontallyEye(c, -angleX); ! Camera.rotateVerticallyEye(c, angleY); } else { // rotate camera about point of view (or selection if any) ! double[] pivot = super.selectionCenter(); ! Camera.rotateHorizontally(c, -angleX, pivot); ! Camera.rotateVertically(c, angleY, pivot); } glv.repaint(); *************** *** 130,133 **** --- 136,141 ---- mode = ROTATION; } + } else if (e.getButton() == MouseEvent.BUTTON3) { + glv.changeTool(Tool.PREVIOUS_TOOL); } } Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ToolFactory.java 5 Dec 2005 07:56:50 -0000 1.18 --- ToolFactory.java 14 Dec 2005 14:20:34 -0000 1.19 *************** *** 51,58 **** /** rotation tool */ private CameraTool rotation; /** Tape measure tool */ private TapeMeasureTool tapeMeasure; ! /** The previous tool */ private Tool previousTool; --- 51,61 ---- /** rotation tool */ private CameraTool rotation; + + /** Camera fly tool */ + private CameraFlyTool fly; /** Tape measure tool */ private TapeMeasureTool tapeMeasure; ! /** The previous tool */ private Tool previousTool; *************** *** 80,83 **** --- 83,90 ---- Cursor dragCursor = Toolkit.getDefaultToolkit().createCustomCursor(dragImage, new Point(7, 8), "Drag"); + url = cl.getResource("Biconfly.gif"); + Image flyImage = Toolkit.getDefaultToolkit().getImage(url); + Cursor flyCursor = + Toolkit.getDefaultToolkit().createCustomCursor(flyImage, new Point(7, 8), "Fly"); Toolbar tb = Toolbar.getInstance(); *************** *** 96,99 **** --- 103,108 ---- but = tb.registerAction(new TapeMeasureAction(glv)); but.setToolTipText("Tape Measure"); + but = tb.registerAction(new CameraFlyAction(glv)); + but.setToolTipText("Fly mode"); *************** *** 105,108 **** --- 114,118 ---- rotation = new CameraTool(glv, rotationCursor, dragCursor); tapeMeasure = new TapeMeasureTool(glv, pencilcursor); + fly = new CameraFlyTool(glv, flyCursor); Notifier.getInstance().addListener(select); *************** *** 165,168 **** --- 175,181 ---- currentTool = rotation; return rotation; + } else if (i == Tool.FLY_TOOL) { + currentTool = fly; + return fly; } else if (i == Tool.TAPE_MEASURE_TOOL) { currentTool = tapeMeasure; *************** *** 231,234 **** --- 244,275 ---- } } + + /** + * The rotation action inner class + */ + class CameraFlyAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + CameraFlyAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("Biconfly.gif"); + ImageIcon im = new ImageIcon(url); + putValue(Action.SMALL_ICON, im); + } + + /** + * Called when the button is pressed + * @param e The ActionEvent + */ + public void actionPerformed(ActionEvent e) { + glv.changeTool(Tool.FLY_TOOL); + } + } /** *************** *** 380,383 **** } } - } --- 421,423 ---- Index: CameraFlyTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraFlyTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CameraFlyTool.java 13 Dec 2005 12:52:06 -0000 1.1 --- CameraFlyTool.java 14 Dec 2005 14:20:34 -0000 1.2 *************** *** 9,14 **** import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Camera; - //import java.awt.event.KeyEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; --- 9,14 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Vertex; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; *************** *** 32,37 **** super(glv, cursor); } - - /** --- 32,35 ---- *************** *** 40,48 **** */ protected void moved(MouseEvent e) { - Camera c = glv.getView().getCamera(); - double angleX = ((double)(e.getX() - previousPos[0]) / 360) * Math.PI; - double angleY = ((double)(e.getY() - previousPos[1]) / 360) * Math.PI; - Camera.rotateHorizontallyEye(c, angleX); - Camera.rotateVerticallyEye(c, angleY); } --- 38,41 ---- *************** *** 52,55 **** --- 45,56 ---- */ protected void dragged(MouseEvent e) { + if (e.getButton() == MouseEvent.BUTTON1 || + (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK) { + Camera c = glv.getView().getCamera(); + double angleX = ((double)(e.getX() - previousPos[0]) / 360) * Math.PI; + double angleY = ((double)(e.getY() - previousPos[1]) / 360) * Math.PI; + Camera.rotateHorizontallyEye(c, -angleX); + Camera.rotateVerticallyEye(c, angleY); + } } *************** *** 73,80 **** */ public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { ! // move forward } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { ! // move backward } else { super.keyPressed(e); --- 74,95 ---- */ public void keyPressed(KeyEvent e) { + Camera c = glv.getView().getCamera(); + Vertex up = new Vertex("", c.getRoll()[0], c.getRoll()[1], c.getRoll()[2]); + double x = c.getCenter()[0] - c.getCamera()[0]; + double y = c.getCenter()[1] - c.getCamera()[1]; + double z = c.getCenter()[2] - c.getCamera()[2]; + Vertex forward = new Vertex("", x, y, z); + forward.scale(1 / forward.length()); + Vertex sidewards = up.cross(forward); + sidewards.scale(1 / sidewards.length()); + if (e.getKeyCode() == KeyEvent.VK_UP) { ! c.translate(new double[] {forward.getX(), forward.getY(), forward.getZ()}); } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { ! c.translate(new double[] {-forward.getX(), -forward.getY(), -forward.getZ()}); ! } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { ! c.translate(new double[] {sidewards.getX(), sidewards.getY(), sidewards.getZ()}); ! } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { ! c.translate(new double[] {-sidewards.getX(), -sidewards.getY(), -sidewards.getZ()}); } else { super.keyPressed(e); Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Tool.java 6 Dec 2005 16:49:19 -0000 1.14 --- Tool.java 14 Dec 2005 14:20:34 -0000 1.15 *************** *** 34,37 **** --- 34,39 ---- /** The Tape Measure tool */ public static final int TAPE_MEASURE_TOOL = 6; + /** The Fly tool */ + public static final int FLY_TOOL = 7; /** Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** AbstractTool.java 12 Dec 2005 14:33:22 -0000 1.35 --- AbstractTool.java 14 Dec 2005 14:20:34 -0000 1.36 *************** *** 9,12 **** --- 9,13 ---- import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Surface; *************** *** 100,103 **** --- 101,112 ---- int rotation = e.getWheelRotation(); Camera cam = (glv.getView()).getCamera(); + /*double[] camera = cam.getCamera(); + double[] center = cam.getCenter(); + double x = camera[0] - center[0]; + double y = camera[1] - center[1]; + double z = camera[2] - center[2]; + Vertex v = glv.getView().toPlaneCoords(new double[] {e.getX(), + e.getY()}, + new Plane(x, y, z, 0));*/ if (rotation > 0) { cam.zoomout(); |
From: rimestad <rim...@us...> - 2005-12-14 14:20:46
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18470/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: made small fixes and improvements to the camera tool and added a flytool Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** View.java 12 Dec 2005 20:19:53 -0000 1.29 --- View.java 14 Dec 2005 14:20:35 -0000 1.30 *************** *** 419,423 **** } ! camera(gld); gl.glPushMatrix(); picking = 0; --- 419,423 ---- } ! initCamera(gld); gl.glPushMatrix(); picking = 0; *************** *** 1733,1737 **** */ public List getObjectAtPoint(double x, double y) { - int id; this.x = x; this.y = y; --- 1733,1736 ---- *************** *** 2011,2015 **** * @param gld The GLDrawable object */ ! public void camera(GLDrawable gld) { if (log.isDebugEnabled()) { log.debug("[display]"); --- 2010,2014 ---- * @param gld The GLDrawable object */ ! public void initCamera(GLDrawable gld) { if (log.isDebugEnabled()) { log.debug("[display]"); |
From: rimestad <rim...@us...> - 2005-12-13 12:52:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6631/src/net/sourceforge/bprocessor/gl/tool Added Files: CameraFlyTool.java Log Message: Not done yet so aint in the gui... --- NEW FILE: CameraFlyTool.java --- //--------------------------------------------------------------------------------- // $Id: CameraFlyTool.java,v 1.1 2005/12/13 12:52:06 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Camera; //import java.awt.event.KeyEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.Cursor; import org.apache.log4j.Logger; /** * The camera fly tool */ public class CameraFlyTool extends AbstractTool { /** The logger */ private static Logger log = Logger.getLogger(CameraFlyTool.class); /** * Constructor * @param glv The 3D canvas * @param cursor the cursor */ public CameraFlyTool(GLView glv, Cursor cursor) { super(glv, cursor); } /** * Invoked when the mouse cursor has been moved * @param e The MouseEvent object */ protected void moved(MouseEvent e) { Camera c = glv.getView().getCamera(); double angleX = ((double)(e.getX() - previousPos[0]) / 360) * Math.PI; double angleY = ((double)(e.getY() - previousPos[1]) / 360) * Math.PI; Camera.rotateHorizontallyEye(c, angleX); Camera.rotateVerticallyEye(c, angleY); } /** * Invoked when the mouse is held pressed and moved * @param e The MouseEvent object */ protected void dragged(MouseEvent e) { } /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ protected void pressed(MouseEvent e) { } /** * Invoked when a mouse button has been released on a component. * @param e The MouseEvent */ protected void released(MouseEvent e) { } /** * Invoked when a key has been pressed. Lets user control the speed * and mode of movement. * @param e The KeyEvent */ public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { // move forward } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { // move backward } else { super.keyPressed(e); } glv.repaint(true); } } |
From: rimestad <rim...@us...> - 2005-12-13 12:37:32
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3655/src/net/sourceforge/bprocessor/gl/tool Modified Files: CameraTool.java Log Message: Refactored all the rotation from cameratool to the camera in the model as static methods. Fixed small bug with tilting when rotating. There is still a bug when rotation about the eye point though Index: CameraTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CameraTool.java 12 Dec 2005 14:33:22 -0000 1.3 --- CameraTool.java 13 Dec 2005 12:37:20 -0000 1.4 *************** *** 10,14 **** import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Camera; - import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Vertex; --- 10,13 ---- *************** *** 19,24 **** import java.awt.Cursor; - import javax.swing.Timer; - import org.apache.log4j.Logger; --- 18,21 ---- *************** *** 36,45 **** private static Logger log = Logger.getLogger(CameraTool.class); - /** The carmera move timer */ - private static Timer timer; - - /** The mouse position last time the mouse was pressed initializes to (0,0) */ - private static int[] pressPos = new int[2]; - /** The current rotation mode */ protected int mode = ROTATION; --- 33,36 ---- *************** *** 104,123 **** } else if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK || e.getButton() == MouseEvent.BUTTON1) { - double[] pivot = super.selectionCenter(); - double[] zero = new double[]{0, 0, 0}; - - Vertex up = new Vertex("", roll[0], roll[1], roll[2]); - up.scale(1 / up.length()); - double x = center[0] - camera[0]; - double y = center[1] - camera[1]; - double z = center[2] - camera[2]; - Vertex forward = new Vertex("", x, y, z); - forward.scale(1 / forward.length()); - Vertex sidewards = up.cross(forward); - sidewards.scale(1 / sidewards.length()); - /*log.info("forward: " + forward.getX() + ", " + forward.getY() + ", " + forward.getZ()); - log.info("sideward: " + sidewards.getX() - + ", " + sidewards.getY() + ", " + sidewards.getZ()); - log.info("upwrad: " + up.getX() + ", " + up.getY() + ", " + up.getZ());*/ double angleX = ((double)(e.getX() - previousPos[0]) / 360) * Math.PI; double angleY = ((double)(e.getY() - previousPos[1]) / 360) * Math.PI; --- 95,98 ---- *************** *** 129,153 **** if (e.isShiftDown()) { // roll camera ! Geometry.rotate(turn * (-angleY - angleX) / 2, forward.getX(), ! forward.getY(), forward.getZ(), roll, zero); } else if (e.isAltDown()) { // rotate camera about itself ! Geometry.rotate(angleX, up.getX(), up.getY(), up.getZ(), center, camera); ! Geometry.rotate(-angleY, sidewards.getX(), sidewards.getY(), sidewards.getZ(), ! center, camera); ! Geometry.rotate(angleX, 0, 0, turn, roll, new double[]{0, 0, 0}); ! Geometry.rotate(angleY, sidewards.getX(), sidewards.getY(), sidewards.getZ(), ! roll, zero); } else { // rotate camera about point of view (or selection if any) ! Geometry.rotate(-angleX, 0, 0, turn, camera, pivot); ! Geometry.rotate(-angleX, 0, 0, turn, center, pivot); ! Geometry.rotate(-angleX, 0, 0, turn, roll, new double[]{0, 0, 0}); ! Geometry.rotate(angleY, sidewards.getX(), sidewards.getY(), sidewards.getZ(), ! camera, pivot); ! Geometry.rotate(angleY, sidewards.getX(), sidewards.getY(), sidewards.getZ(), ! center, pivot); ! Geometry.rotate(angleY, sidewards.getX(), sidewards.getY(), sidewards.getZ(), ! roll, zero); } glv.repaint(); --- 104,116 ---- if (e.isShiftDown()) { // roll camera ! Camera.rollCamera(c, turn * (-angleY - angleX) / 2); } else if (e.isAltDown()) { // rotate camera about itself ! Camera.rotateHorizontallyEye(c, angleX); ! Camera.rotateVerticallyEye(c, -angleY); } else { // rotate camera about point of view (or selection if any) ! Camera.rotateHorizontally(c, -angleX, center); ! Camera.rotateVertically(c, angleY, center); } glv.repaint(); |
From: rimestad <rim...@us...> - 2005-12-13 12:37:23
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3644/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Log Message: Refactored all the rotation from cameratool to the camera in the model as static methods. Fixed small bug with tilting when rotating. There is still a bug when rotation about the eye point though Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Camera.java 12 Dec 2005 14:17:12 -0000 1.1 --- Camera.java 13 Dec 2005 12:37:15 -0000 1.2 *************** *** 229,231 **** --- 229,330 ---- camera[2] += (camera[2] - center[2]) * 0.1; } + + /** + * Rotate the camera horizontal about eye position + * @param c the camera to rotate + * @param angle the angle to rotate + */ + public static void rotateHorizontallyEye(Camera c, double angle) { + Vertex up = new Vertex("", c.roll[0], c.roll[1], c.roll[2]); + up.scale(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.scale(1 / forward.length()); + double turn = 1; + if (c.roll[2] < 0) { + turn = -1; + } + Geometry.rotate(angle, up.getX(), up.getY(), up.getZ(), c.center, c.camera); + Geometry.rotate(angle, 0, 0, turn, c.roll, new double[]{0, 0, 0}); + } + + /** + * Rotate the camera vertical about eye position + * @param c the camera to rotate + * @param angle the angle to rotate + */ + public static void rotateVerticallyEye(Camera c, double angle) { + Vertex up = new Vertex("", c.roll[0], c.roll[1], c.roll[2]); + up.scale(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.scale(1 / forward.length()); + Vertex sidewards = up.cross(forward); + sidewards.scale(1 / sidewards.length()); + + Geometry.rotate(angle, sidewards.getX(), sidewards.getY(), sidewards.getZ(), + c.center, c.camera); + Geometry.rotate(angle, sidewards.getX(), sidewards.getY(), sidewards.getZ(), + c.roll, new double[]{0, 0, 0}); + } + + /** + * Rotate the camera horizontal about the given center + * @param c the camera to rotate + * @param angle the angle to rotate + * @param center the rotation center + */ + public static void rotateHorizontally(Camera c, double angle, double[] center) { + double turn = 1; + if (c.roll[2] < 0) { + turn = -1; + } + Geometry.rotate(angle, 0, 0, turn, c.camera, center); + Geometry.rotate(angle, 0, 0, turn, c.center, center); + Geometry.rotate(angle, 0, 0, turn, c.roll, new double[]{0, 0, 0}); + } + + /** + * Rotate the camera vertical about the given center + * @param c the camera to rotate + * @param angle the angle to rotate + * @param center the rotation center + */ + public static void rotateVertically(Camera c, double angle, double[] center) { + Vertex up = new Vertex("", c.roll[0], c.roll[1], c.roll[2]); + //up.scale(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.scale(1 / forward.length()); + Vertex sidewards = up.cross(forward); + sidewards.scale(1 / sidewards.length()); + + Geometry.rotate(angle, sidewards.getX(), sidewards.getY(), sidewards.getZ(), + c.camera, center); + Geometry.rotate(angle, sidewards.getX(), sidewards.getY(), sidewards.getZ(), + c.center, center); + Geometry.rotate(angle, sidewards.getX(), sidewards.getY(), sidewards.getZ(), + c.roll, new double[]{0, 0, 0}); + } + + /** + * Rotate the tip of the camera + * @param c The camera + * @param angle The angle of tip + */ + public static void rollCamera(Camera c, double angle) { + 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.scale(1 / forward.length()); + Geometry.rotate(angle / 2, forward.getX(), + forward.getY(), forward.getZ(), c.roll, new double[] {0, 0, 0}); + } } |
From: Nikolaj B. <nbr...@us...> - 2005-12-13 11:55:33
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25973/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: Added views tab, and made all tabs scrollable. Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** GUI.java 11 Dec 2005 17:27:54 -0000 1.15 --- GUI.java 13 Dec 2005 11:55:17 -0000 1.16 *************** *** 306,311 **** JTabbedPane tp = new JTabbedPane(JTabbedPane.TOP); ! tp.addTab("Spaces", new SpacesTreeView()); ! tp.addTab("Surfaces", new SurfacesTreeView()); tp.setPreferredSize(new Dimension(170, 340)); splitPaneTopDown.setMinimumSize(new Dimension(170, 340)); --- 306,313 ---- JTabbedPane tp = new JTabbedPane(JTabbedPane.TOP); ! tp.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); ! tp.addTab("Views", new JScrollPane (null)); ! tp.addTab("Spaces", new JScrollPane (new SpacesTreeView())); ! tp.addTab("Surfaces", new JScrollPane (new SurfacesTreeView())); tp.setPreferredSize(new Dimension(170, 340)); splitPaneTopDown.setMinimumSize(new Dimension(170, 340)); |