Thread: [Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Direction.java, 1.15, 1.16 Geometry.
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-11-13 12:19:32
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22683/src/net/sourceforge/bprocessor/model Modified Files: Direction.java Geometry.java Line.java EnergyCalc.java Command.java CoordinateSystem.java Edge.java Vertex.java ClippingPlane.java SpaceAnalysis.java Surface.java Camera.java Space.java Plane.java Log Message: renamed Vertex.scale to scaleInPlace Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Command.java 13 Nov 2007 09:03:41 -0000 1.27 --- Command.java 13 Nov 2007 12:19:29 -0000 1.28 *************** *** 537,541 **** double length = v.length(); double delta = length / n; ! v.scale(delta / length); Vertex current = from; Space space = edge.getOwner(); --- 537,541 ---- double length = v.length(); double delta = length / n; ! v.scaleInPlace(delta / length); Vertex current = from; Space space = edge.getOwner(); *************** *** 602,606 **** Vertex normal = v.copy(); normal.setZ(0); ! normal.scale(-1); normal.normalize(); normals.add(normal); --- 602,606 ---- Vertex normal = v.copy(); normal.setZ(0); ! normal.scaleInPlace(-1); normal.normalize(); normals.add(normal); Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** CoordinateSystem.java 13 Nov 2007 09:46:28 -0000 1.63 --- CoordinateSystem.java 13 Nov 2007 12:19:29 -0000 1.64 *************** *** 320,330 **** Vertex origin = v0; Vertex i = v1.minus(v0); ! i.scale(1 / i.length()); Vertex v = v2.minus(v1); Vertex n = i.cross(v); if (n.length() > 0) { ! n.scale(1 / n.length()); Vertex j = n.cross(i); ! j.scale(1 / j.length()); return new CoordinateSystem(i, j, n, origin); } else { --- 320,330 ---- Vertex origin = v0; Vertex i = v1.minus(v0); ! i.scaleInPlace(1 / i.length()); Vertex v = v2.minus(v1); Vertex n = i.cross(v); if (n.length() > 0) { ! n.scaleInPlace(1 / n.length()); Vertex j = n.cross(i); ! j.scaleInPlace(1 / j.length()); return new CoordinateSystem(i, j, n, origin); } else { *************** *** 401,405 **** projection.setZ(n.getZ()); double scalar = n.dot(vector); ! projection.scale(scalar); return projection; } --- 401,405 ---- projection.setZ(n.getZ()); double scalar = n.dot(vector); ! projection.scaleInPlace(scalar); return projection; } *************** *** 425,429 **** double t = vector.dot(n); Vertex normal = n.copy(); ! normal.scale(t); vector = vector.minus(normal); return origin.add(vector); --- 425,429 ---- double t = vector.dot(n); Vertex normal = n.copy(); ! normal.scaleInPlace(t); vector = vector.minus(normal); return origin.add(vector); *************** *** 466,474 **** public Vertex unTranslate(Vertex vertex) { Vertex ii = i.copy(); ! ii.scale(vertex.getX()); Vertex jj = j.copy(); ! jj.scale(vertex.getY()); Vertex nn = n.copy(); ! nn.scale(vertex.getZ()); Vertex result = getOrigin().add(ii).add(jj).add(nn); return result; --- 466,474 ---- public Vertex unTranslate(Vertex vertex) { Vertex ii = i.copy(); ! ii.scaleInPlace(vertex.getX()); Vertex jj = j.copy(); ! jj.scaleInPlace(vertex.getY()); Vertex nn = n.copy(); ! nn.scaleInPlace(vertex.getZ()); Vertex result = getOrigin().add(ii).add(jj).add(nn); return result; *************** *** 633,638 **** Vertex v = i.copy(); Vertex u = j.copy(); ! v.scale(size); ! u.scale(size); Vertex a = origin.add(u).minus(v); Vertex b = origin.add(u).add(v); --- 633,638 ---- Vertex v = i.copy(); Vertex u = j.copy(); ! v.scaleInPlace(size); ! u.scaleInPlace(size); Vertex a = origin.add(u).minus(v); Vertex b = origin.add(u).add(v); *************** *** 694,703 **** Vertex o = getOrigin(); Vertex i = getI().copy(); ! i.scale(size); Vertex from = o.minus(i); Vertex to = o.add(i); list.add(new Guide(from, to)); Vertex j = getJ().copy(); ! j.scale(size); from = o.minus(j); to = o.add(j); --- 694,703 ---- Vertex o = getOrigin(); Vertex i = getI().copy(); ! i.scaleInPlace(size); Vertex from = o.minus(i); Vertex to = o.add(i); list.add(new Guide(from, to)); Vertex j = getJ().copy(); ! j.scaleInPlace(size); from = o.minus(j); to = o.add(j); *************** *** 705,709 **** if (!onlyPlane()) { Vertex n = getN().copy(); ! n.scale(size); from = o.minus(n); to = o.add(n); --- 705,709 ---- if (!onlyPlane()) { Vertex n = getN().copy(); ! n.scaleInPlace(size); from = o.minus(n); to = o.add(n); *************** *** 753,757 **** i = j; j = tmp; ! n.scale(-1); } --- 753,757 ---- i = j; j = tmp; ! n.scaleInPlace(-1); } *************** *** 857,861 **** this.vector = vector; Vertex v = vector.copy(); ! v.scale(distance); v = getOrigin().add(v); setX(v.getX()); --- 857,861 ---- this.vector = vector; Vertex v = vector.copy(); ! v.scaleInPlace(distance); v = getOrigin().add(v); setX(v.getX()); Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.205 retrieving revision 1.206 diff -C2 -d -r1.205 -r1.206 *** Surface.java 13 Nov 2007 10:04:29 -0000 1.205 --- Surface.java 13 Nov 2007 12:19:29 -0000 1.206 *************** *** 626,630 **** public Surface extrusion(double delta, Collection sides) { Vertex normal = normal(); ! normal.scale(delta); List vertices = getVertices(); List edges = getEdges(); --- 626,630 ---- public Surface extrusion(double delta, Collection sides) { Vertex normal = normal(); ! normal.scaleInPlace(delta); List vertices = getVertices(); List edges = getEdges(); *************** *** 794,798 **** } else { Vertex ncopy = normal.copy(); ! ncopy.scale(distance); vmap[i] = v[i].copy().add(ncopy); } --- 794,798 ---- } else { Vertex ncopy = normal.copy(); ! ncopy.scaleInPlace(distance); vmap[i] = v[i].copy().add(ncopy); } *************** *** 1611,1618 **** origin = getFirstVertex(); i = e0.otherVertex(origin).minus(origin); ! i.scale(1 / i.length()); j = n.cross(i); if (j != null) { ! j.scale(1 / j.length()); return new CoordinateSystem(i, j, n, origin.copy()); } --- 1611,1618 ---- origin = getFirstVertex(); i = e0.otherVertex(origin).minus(origin); ! i.scaleInPlace(1 / i.length()); j = n.cross(i); if (j != null) { ! j.scaleInPlace(1 / j.length()); return new CoordinateSystem(i, j, n, origin.copy()); } Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** Edge.java 13 Nov 2007 09:46:27 -0000 1.100 --- Edge.java 13 Nov 2007 12:19:29 -0000 1.101 *************** *** 471,475 **** Vertex w = vertex.minus(from); double t = v.dot(w); ! v.scale(t / (length * length)); return from.add(v); } --- 471,475 ---- Vertex w = vertex.minus(from); double t = v.dot(w); ! v.scaleInPlace(t / (length * length)); return from.add(v); } *************** *** 607,611 **** } if ((t > 0 && t < 1)) { ! r.scale(t); Vertex p = p0.add(r).minus(q); if (p.length() < 0.0000001) { --- 607,611 ---- } if ((t > 0 && t < 1)) { ! r.scaleInPlace(t); Vertex p = p0.add(r).minus(q); if (p.length() < 0.0000001) { *************** *** 635,639 **** t = (q.getZ() - p0.getZ()) / r.getZ(); } ! r.scale(t); Vertex p = p0.add(r).minus(q); if (p.length() < 0.0000001) { --- 635,639 ---- t = (q.getZ() - p0.getZ()) / r.getZ(); } ! r.scaleInPlace(t); Vertex p = p0.add(r).minus(q); if (p.length() < 0.0000001) { *************** *** 771,780 **** org1 = dir1.cross(normal); org1.normalize(); ! org1.scale(((Double)offsetMap.get(e1)).doubleValue()); } if (which.contains(e2)) { org2 = dir2.cross(normal); org2.normalize(); ! org2.scale(((Double)offsetMap.get(e2)).doubleValue()); } org1 = org1.add(work); --- 771,780 ---- org1 = dir1.cross(normal); org1.normalize(); ! org1.scaleInPlace(((Double)offsetMap.get(e1)).doubleValue()); } if (which.contains(e2)) { org2 = dir2.cross(normal); org2.normalize(); ! org2.scaleInPlace(((Double)offsetMap.get(e2)).doubleValue()); } org1 = org1.add(work); *************** *** 801,805 **** scale = ((Double)offsetMap.get(e2)).doubleValue(); } ! mainDir.scale(scale); } v2Dir.put(work, mainDir); --- 801,805 ---- scale = ((Double)offsetMap.get(e2)).doubleValue(); } ! mainDir.scaleInPlace(scale); } v2Dir.put(work, mainDir); *************** *** 863,867 **** Vertex workDir = (Vertex)directions.get(work); workDir.normalize(); ! workDir.scale(((Double)offsetMap.get(e1)).doubleValue() / workDir.dot(dir1)); ((Vertex)v2v.get(work)).move(workDir.getX(), workDir.getY(), workDir.getZ()); --- 863,867 ---- Vertex workDir = (Vertex)directions.get(work); workDir.normalize(); ! workDir.scaleInPlace(((Double)offsetMap.get(e1)).doubleValue() / workDir.dot(dir1)); ((Vertex)v2v.get(work)).move(workDir.getX(), workDir.getY(), workDir.getZ()); *************** *** 872,876 **** Vertex workDir = (Vertex)directions.get(work); workDir.normalize(); ! workDir.scale(((Double)offsetMap.get(e2)).doubleValue() / workDir.dot(dir2)); ((Vertex)v2v.get(work)).move(workDir.getX(), workDir.getY(), workDir.getZ()); --- 872,876 ---- Vertex workDir = (Vertex)directions.get(work); workDir.normalize(); ! workDir.scaleInPlace(((Double)offsetMap.get(e2)).doubleValue() / workDir.dot(dir2)); ((Vertex)v2v.get(work)).move(workDir.getX(), workDir.getY(), workDir.getZ()); *************** *** 1006,1010 **** dir2.normalize(); Vertex mainDir = dir1.add(dir2); ! mainDir.scale(1 / mainDir.dot(dir1)); dir.setDirection(mainDir); } else { --- 1006,1010 ---- dir2.normalize(); Vertex mainDir = dir1.add(dir2); ! mainDir.scaleInPlace(1 / mainDir.dot(dir1)); dir.setDirection(mainDir); } else { *************** *** 1024,1028 **** Vertex dir2 = other.minus(work); dir2.normalize(); ! dir2.scale(1 / dir2.dot(dir1)); dir.setDirection(dir2); } else { --- 1024,1028 ---- Vertex dir2 = other.minus(work); dir2.normalize(); ! dir2.scaleInPlace(1 / dir2.dot(dir1)); dir.setDirection(dir2); } else { *************** *** 1046,1050 **** Vertex dir1 = other.minus(work); dir1.normalize(); ! dir1.scale(1 / dir1.dot(dir2)); dir.setDirection(dir1); } else { --- 1046,1050 ---- Vertex dir1 = other.minus(work); dir1.normalize(); ! dir1.scaleInPlace(1 / dir1.dot(dir2)); dir.setDirection(dir1); } else { *************** *** 1061,1067 **** Direction cur = (Direction)diriter.next(); Vertex dir = cur.getDirection(); ! dir.scale(-1); dir = dir.copy(); ! dir.scale(offset); cur.getVertex().move(dir.getX(), dir.getY(), dir.getZ()); } --- 1061,1067 ---- Direction cur = (Direction)diriter.next(); Vertex dir = cur.getDirection(); ! dir.scaleInPlace(-1); dir = dir.copy(); ! dir.scaleInPlace(offset); cur.getVertex().move(dir.getX(), dir.getY(), dir.getZ()); } Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ClippingPlane.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ClippingPlane.java 13 Nov 2007 09:46:27 -0000 1.22 --- ClippingPlane.java 13 Nov 2007 12:19:29 -0000 1.23 *************** *** 87,91 **** Vertex n = c.getN().copy(); n.normalize(); ! n.scale(0.00001); c.move(n.getX(), n.getY(), n.getZ()); plane = c.plane(); --- 87,91 ---- Vertex n = c.getN().copy(); n.normalize(); ! n.scaleInPlace(0.00001); c.move(n.getX(), n.getY(), n.getZ()); plane = c.plane(); Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** Camera.java 12 Oct 2007 14:34:37 -0000 1.46 --- Camera.java 13 Nov 2007 12:19:29 -0000 1.47 *************** *** 388,397 **** 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); Geometry.rotate(angle, 0, 0, 1, c.roll, new double[]{0, 0, 0}); --- 388,397 ---- public static void rotateHorizontallyEye(Camera c, double angle) { Vertex up = new Vertex(c.roll[0], c.roll[1], c.roll[2]); ! up.scaleInPlace(1 / up.length()); double x = c.center[0] - c.camera[0]; double y = c.center[1] - c.camera[1]; double z = c.center[2] - c.camera[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleInPlace(1 / forward.length()); Geometry.rotate(angle, 0, 0, 1, c.center, c.camera); Geometry.rotate(angle, 0, 0, 1, c.roll, new double[]{0, 0, 0}); *************** *** 405,416 **** 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(), --- 405,416 ---- public static void rotateVerticallyEye(Camera c, double angle) { Vertex up = new Vertex(c.roll[0], c.roll[1], c.roll[2]); ! up.scaleInPlace(1 / up.length()); double x = c.center[0] - c.camera[0]; double y = c.center[1] - c.camera[1]; double z = c.center[2] - c.camera[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleInPlace(1 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleInPlace(1 / sidewards.length()); Geometry.rotate(angle, sidewards.getX(), sidewards.getY(), sidewards.getZ(), *************** *** 451,455 **** //forward.scale(1 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scale(1 / sidewards.length()); Geometry.rotate(angle, sidewards.getX(), sidewards.getY(), sidewards.getZ(), --- 451,455 ---- //forward.scale(1 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleInPlace(1 / sidewards.length()); Geometry.rotate(angle, sidewards.getX(), sidewards.getY(), sidewards.getZ(), *************** *** 471,475 **** 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}); --- 471,475 ---- double z = c.center[2] - c.camera[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleInPlace(1 / forward.length()); Geometry.rotate(angle / 2, forward.getX(), forward.getY(), forward.getZ(), c.roll, new double[] {0, 0, 0}); *************** *** 522,526 **** if (p1 != null && p2 != null) { Vertex modelCenter = p1.minus(p2); ! modelCenter.scale(1.0 / 2.0); modelCenter = modelCenter.add(p2); //expand sphere if needs --- 522,526 ---- if (p1 != null && p2 != null) { Vertex modelCenter = p1.minus(p2); ! modelCenter.scaleInPlace(1.0 / 2.0); modelCenter = modelCenter.add(p2); //expand sphere if needs *************** *** 533,537 **** if (dist > radius) { radius = (dist + radius) / 2.0; ! dV.scale((dist - radius) / dist); modelCenter = modelCenter.add(dV); } --- 533,537 ---- if (dist > radius) { radius = (dist + radius) / 2.0; ! dV.scaleInPlace((dist - radius) / dist); modelCenter = modelCenter.add(dV); } *************** *** 547,551 **** camera[1] - center[1], camera[2] - center[2]); ! cameraPos.scale(cameraDistance / cameraPos.length()); cameraPos = cameraPos.add(modelCenter); setCenter(new double[] {modelCenter.getX(), --- 547,551 ---- camera[1] - center[1], camera[2] - center[2]); ! cameraPos.scaleInPlace(cameraDistance / cameraPos.length()); cameraPos = cameraPos.add(modelCenter); setCenter(new double[] {modelCenter.getX(), *************** *** 791,795 **** double[] center = current.getCenter(); Vertex back = new Vertex(camera).minus(new Vertex(center)); ! back.scale(length / back.length()); camera[0] = center[0] + back.getX(); camera[1] = center[1] + back.getY(); --- 791,795 ---- double[] center = current.getCenter(); Vertex back = new Vertex(camera).minus(new Vertex(center)); ! back.scaleInPlace(length / back.length()); camera[0] = center[0] + back.getX(); camera[1] = center[1] + back.getY(); Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Plane.java 28 Sep 2007 14:04:58 -0000 1.31 --- Plane.java 13 Nov 2007 12:19:29 -0000 1.32 *************** *** 105,109 **** public Vertex normal() { Vertex normal = new Vertex(a, b, c); ! normal.scale(1 / normal.length()); return normal; } --- 105,109 ---- public Vertex normal() { Vertex normal = new Vertex(a, b, c); ! normal.scaleInPlace(1 / normal.length()); return normal; } *************** *** 167,171 **** Vertex temp = alfa.cross(beta); Vertex norm = temp.cross(beta); ! norm.scale(1 / norm.length()); Vertex intersec = intersection(rayIn); double a = norm.getX(); --- 167,171 ---- Vertex temp = alfa.cross(beta); Vertex norm = temp.cross(beta); ! norm.scaleInPlace(1 / norm.length()); Vertex intersec = intersection(rayIn); double a = norm.getX(); *************** *** 235,239 **** Vertex normal = normal(); double t = vector.dot(normal()); ! normal.scale(t / normal.length()); vector = vector.minus(normal); return origin().add(vector); --- 235,239 ---- Vertex normal = normal(); double t = vector.dot(normal()); ! normal.scaleInPlace(t / normal.length()); vector = vector.minus(normal); return origin().add(vector); *************** *** 316,320 **** i.setY(i.getY() - n.getY() * t); i.setZ(i.getZ() - n.getZ() * t); ! i.scale(1 / i.length()); j = n.cross(i); --- 316,320 ---- i.setY(i.getY() - n.getY() * t); i.setZ(i.getZ() - n.getZ() * t); ! i.scaleInPlace(1 / i.length()); j = n.cross(i); Index: SpaceAnalysis.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SpaceAnalysis.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SpaceAnalysis.java 29 Sep 2007 13:06:34 -0000 1.7 --- SpaceAnalysis.java 13 Nov 2007 12:19:29 -0000 1.8 *************** *** 125,129 **** Vertex i = leader.normal(); int direction = travel(leader, edge); ! n.scale(direction); Surface selected = leader; double minimum = 2 * Math.PI; --- 125,129 ---- Vertex i = leader.normal(); int direction = travel(leader, edge); ! n.scaleInPlace(direction); Surface selected = leader; double minimum = 2 * Math.PI; *************** *** 133,137 **** Vertex normal = current.normal(); if (travel(current, edge) != direction) { ! normal.scale(-1); } double t = i.dot(normal); --- 133,137 ---- Vertex normal = current.normal(); if (travel(current, edge) != direction) { ! normal.scaleInPlace(-1); } double t = i.dot(normal); Index: Direction.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Direction.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Direction.java 27 Sep 2007 10:41:45 -0000 1.15 --- Direction.java 13 Nov 2007 12:19:29 -0000 1.16 *************** *** 55,59 **** double slideScale; Vertex vunit = v.copy(); ! vunit.scale(1 / v.length()); if (v.getX() != 0) { slideScale = v.getX() / (slideDir.dot(vunit) * vunit.getX()); --- 55,59 ---- double slideScale; Vertex vunit = v.copy(); ! vunit.scaleInPlace(1 / v.length()); if (v.getX() != 0) { slideScale = v.getX() / (slideDir.dot(vunit) * vunit.getX()); *************** *** 64,68 **** } direction = slideDir; ! direction.scale(slideScale); } --- 64,68 ---- } direction = slideDir; ! direction.scaleInPlace(slideScale); } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.207 retrieving revision 1.208 diff -C2 -d -r1.207 -r1.208 *** Space.java 13 Nov 2007 10:48:39 -0000 1.207 --- Space.java 13 Nov 2007 12:19:29 -0000 1.208 *************** *** 1165,1169 **** average = average.add((Vertex)it.next()); } ! average.scale(1.0 / (double)verts.size()); } return average; --- 1165,1169 ---- average = average.add((Vertex)it.next()); } ! average.scaleInPlace(1.0 / (double)verts.size()); } return average; *************** *** 1884,1890 **** Vertex spaceVector = s.normal(); if (s.getFrontDomain() == this) { ! spaceVector.scale(1 / spaceVector.length()); } else if (s.getBackDomain() == this) { ! spaceVector.scale(-1 / spaceVector.length()); } else { return false; --- 1884,1890 ---- Vertex spaceVector = s.normal(); if (s.getFrontDomain() == this) { ! spaceVector.scaleInPlace(1 / spaceVector.length()); } else if (s.getBackDomain() == this) { ! spaceVector.scaleInPlace(-1 / spaceVector.length()); } else { return false; *************** *** 1915,1919 **** //Building a coordinate system: Vertex n = sharedEdge.getDirection(); ! n.scale(1 / n.length()); Vertex j = startSurface.normal(); --- 1915,1919 ---- //Building a coordinate system: Vertex n = sharedEdge.getDirection(); ! n.scaleInPlace(1 / n.length()); Vertex j = startSurface.normal(); *************** *** 1922,1928 **** } if (startSurface.getFrontDomain() == this) { ! j.scale(1 / j.length()); } else { ! j.scale(-1 / j.length()); } --- 1922,1928 ---- } if (startSurface.getFrontDomain() == this) { ! j.scaleInPlace(1 / j.length()); } else { ! j.scaleInPlace(-1 / j.length()); } *************** *** 1937,1941 **** n.getZ() * sharedVertex.getZ())); Vertex i = (p.project(sharedVertex)).minus(p.project(adjacentVertex)); ! i.scale(1 / i.length()); CoordinateSystem cs = new CoordinateSystem(i, j , n, sharedVertex); --- 1937,1941 ---- n.getZ() * sharedVertex.getZ())); Vertex i = (p.project(sharedVertex)).minus(p.project(adjacentVertex)); ! i.scaleInPlace(1 / i.length()); CoordinateSystem cs = new CoordinateSystem(i, j , n, sharedVertex); *************** *** 1983,1987 **** Vertex projNotShared = coordinateSystem.projection(notShared); Vertex projEdgeDir = projNotShared.minus(projShared); ! projEdgeDir.scale(1 / projEdgeDir.length()); Vertex xAxis = coordinateSystem.getI().copy(); double cosAngle = xAxis.dot(projEdgeDir); --- 1983,1987 ---- Vertex projNotShared = coordinateSystem.projection(notShared); Vertex projEdgeDir = projNotShared.minus(projShared); ! projEdgeDir.scaleInPlace(1 / projEdgeDir.length()); Vertex xAxis = coordinateSystem.getI().copy(); double cosAngle = xAxis.dot(projEdgeDir); Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** Geometry.java 9 Nov 2007 09:45:25 -0000 1.64 --- Geometry.java 13 Nov 2007 12:19:29 -0000 1.65 *************** *** 122,128 **** double tetra = angle(projection); if (tetra > 0) { ! normal.scale(-1); } ! normal.scale(1 / normal.length()); return normal; } --- 122,128 ---- double tetra = angle(projection); if (tetra > 0) { ! normal.scaleInPlace(-1); } ! normal.scaleInPlace(1 / normal.length()); return normal; } *************** *** 222,226 **** double t = v.dot(normal); Vertex up = normal.copy(); ! up.scale(t); projection.add(v.minus(up)); } --- 222,226 ---- double t = v.dot(normal); Vertex up = normal.copy(); ! up.scaleInPlace(t); projection.add(v.minus(up)); } Index: Line.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Line.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Line.java 12 Nov 2007 08:05:25 -0000 1.36 --- Line.java 13 Nov 2007 12:19:29 -0000 1.37 *************** *** 130,134 **** public Vertex getPointAt(double t) { Vertex tmp = direction.copy(); ! tmp.scale(t); return getOrigin().add(tmp); } --- 130,134 ---- public Vertex getPointAt(double t) { Vertex tmp = direction.copy(); ! tmp.scaleInPlace(t); return getOrigin().add(tmp); } *************** *** 195,199 **** Vertex origin = getOrigin(); Vertex direction = getDirection().copy(); ! direction.scale(length); Vertex from = origin.minus(direction); Vertex to = origin.add(direction); --- 195,199 ---- Vertex origin = getOrigin(); Vertex direction = getDirection().copy(); ! direction.scaleInPlace(length); Vertex from = origin.minus(direction); Vertex to = origin.add(direction); *************** *** 261,266 **** double s = ((v2 * w1 - v1 * w2) / denom); double t = ((u1 * w2 - u2 * w1) / -denom); ! d.scale(-s); ! c.scale(-t); Vertex inter1 = d.add(o); Vertex inter2 = c.add(p); --- 261,266 ---- double s = ((v2 * w1 - v1 * w2) / denom); double t = ((u1 * w2 - u2 * w1) / -denom); ! d.scaleInPlace(-s); ! c.scaleInPlace(-t); Vertex inter1 = d.add(o); Vertex inter2 = c.add(p); Index: EnergyCalc.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/EnergyCalc.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** EnergyCalc.java 19 Sep 2007 09:28:22 -0000 1.12 --- EnergyCalc.java 13 Nov 2007 12:19:29 -0000 1.13 *************** *** 94,98 **** Vertex normal = current.normal(); if (current.getBackDomain().isConstructionSpace()) { ! normal.scale(-1); } Vertex origin = current.center(); --- 94,98 ---- Vertex normal = current.normal(); if (current.getBackDomain().isConstructionSpace()) { ! normal.scaleInPlace(-1); } Vertex origin = current.center(); Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Vertex.java 13 Nov 2007 09:42:24 -0000 1.67 --- Vertex.java 13 Nov 2007 12:19:29 -0000 1.68 *************** *** 218,222 **** public Vertex copy(double scale) { Vertex v = this.copy(); ! v.scale(scale); return v; } --- 218,222 ---- public Vertex copy(double scale) { Vertex v = this.copy(); ! v.scaleInPlace(scale); return v; } *************** *** 239,251 **** } ! /** ! * scales the vertex by the the given double ! * @param scale The scale ! */ ! public void scale(double scale) { ! setX(getX() * scale); ! setY(getY() * scale); ! setZ(getZ() * scale); ! } /** --- 239,243 ---- } ! /** *************** *** 384,387 **** --- 376,389 ---- this.setZ(getZ() + dz); } + + /** + * scales the vertex by the the given double + * @param scale The scale + */ + public void scaleInPlace(double scale) { + setX(getX() * scale); + setY(getY() * scale); + setZ(getZ() * scale); + } /** *************** *** 498,502 **** public void normalize() { if (getX() != 0.0 || getY() != 0.0 || getZ() != 0.0) { ! scale(1 / length()); } } --- 500,504 ---- public void normalize() { if (getX() != 0.0 || getY() != 0.0 || getZ() != 0.0) { ! scaleInPlace(1 / length()); } } *************** *** 546,550 **** double scale = this.dot(onto) / onto.dot(onto); Vertex res = onto.copy(); ! res.scale(scale); return res; } --- 548,552 ---- double scale = this.dot(onto) / onto.dot(onto); Vertex res = onto.copy(); ! res.scaleInPlace(scale); return res; } |