[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Edge.java,1.22,1.23 Vertex.java,1.16,
Status: Pre-Alpha
Brought to you by:
henryml
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 + "]"; } } |