[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool OffsetTool.java, 1.22, 1.23 Extrusion
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-11-13 12:19:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22651/src/net/sourceforge/bprocessor/gl/tool Modified Files: OffsetTool.java ExtrusionTool.java ClipplaneTool.java EdgeMoveTool.java FinalMoveTool.java AbstractPencil.java TapeMeasure.java AbstractTool.java CameraFlyTool.java ArcTool.java RectTool.java AltMoveTool.java CameraWalkTool.java ControlledMoveTool.java Log Message: renamed Vertex.scale to scaleInPlace Index: EdgeMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/EdgeMoveTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EdgeMoveTool.java 7 May 2007 13:29:49 -0000 1.3 --- EdgeMoveTool.java 13 Nov 2007 12:19:22 -0000 1.4 *************** *** 182,186 **** Vertex norm = ray.getDirection(); norm.normalize(); ! norm.scale(-1); dragplane = new Plane(norm.getX(), norm.getY(), norm.getZ(), start.vertex()); } else { --- 182,186 ---- Vertex norm = ray.getDirection(); norm.normalize(); ! norm.scaleInPlace(-1); dragplane = new Plane(norm.getX(), norm.getY(), norm.getZ(), start.vertex()); } else { Index: OffsetTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/OffsetTool.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** OffsetTool.java 12 Nov 2007 20:11:55 -0000 1.22 --- OffsetTool.java 13 Nov 2007 12:19:21 -0000 1.23 *************** *** 119,127 **** if (offsetSurface.surrounds(current.vertex())) { if (outNormal.dot(current.vertex().minus(edgePoint)) > 0) { ! outNormal.scale(-1); } } else { if (outNormal.dot(current.vertex().minus(edgePoint)) < 0) { ! outNormal.scale(-1); } } --- 119,127 ---- if (offsetSurface.surrounds(current.vertex())) { if (outNormal.dot(current.vertex().minus(edgePoint)) > 0) { ! outNormal.scaleInPlace(-1); } } else { if (outNormal.dot(current.vertex().minus(edgePoint)) < 0) { ! outNormal.scaleInPlace(-1); } } *************** *** 136,145 **** if (s.surrounds(current.vertex())) { if (outNormal.dot(current.vertex().minus(edgePoint)) > 0) { ! outNormal.scale(-1); } log.debug("Surrounds"); } else { if (outNormal.dot(current.vertex().minus(edgePoint)) < 0) { ! outNormal.scale(-1); } } --- 136,145 ---- if (s.surrounds(current.vertex())) { if (outNormal.dot(current.vertex().minus(edgePoint)) > 0) { ! outNormal.scaleInPlace(-1); } log.debug("Surrounds"); } else { if (outNormal.dot(current.vertex().minus(edgePoint)) < 0) { ! outNormal.scaleInPlace(-1); } } *************** *** 201,205 **** Direction d = directionMap.get(origin); Vertex moveDelta = d.getDirection().copy(); ! moveDelta.scale(length); Vertex to = origin.add(moveDelta); d.getVertex().set(to); --- 201,205 ---- Direction d = directionMap.get(origin); Vertex moveDelta = d.getDirection().copy(); ! moveDelta.scaleInPlace(length); Vertex to = origin.add(moveDelta); d.getVertex().set(to); Index: ClipplaneTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ClipplaneTool.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ClipplaneTool.java 20 Jun 2007 13:17:56 -0000 1.12 --- ClipplaneTool.java 13 Nov 2007 12:19:22 -0000 1.13 *************** *** 59,63 **** boolean front = glv.getView().facingFront(system); if (front) { ! n.scale(-1); } system = new CoordinateSystem(i, j, n, o); --- 59,63 ---- boolean front = glv.getView().facingFront(system); if (front) { ! n.scaleInPlace(-1); } system = new CoordinateSystem(i, j, n, o); Index: ControlledMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledMoveTool.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ControlledMoveTool.java 27 Sep 2007 10:40:38 -0000 1.9 --- ControlledMoveTool.java 13 Nov 2007 12:19:22 -0000 1.10 *************** *** 248,252 **** Vertex normal = surface.normal(); Vertex dir = edgeDir.cross(normal); ! dir.scale(1 / dir.length()); return dir; } --- 248,252 ---- Vertex normal = surface.normal(); Vertex dir = edgeDir.cross(normal); ! dir.scaleInPlace(1 / dir.length()); return dir; } *************** *** 266,280 **** if (slideMap != null && slideMap.keySet().containsAll(vertices)) { Vertex directionCopy = direction.copy(); ! directionCopy.scale(1 / directionCopy.length()); ! directionCopy.scale(delta.dot(directionCopy)); delta = directionCopy; if (delta.length() != 0) { Vertex deltaUnit = delta.copy(); ! deltaUnit.scale(1 / delta.length()); Iterator it = vertices.iterator(); while (it.hasNext()) { Vertex vertex = (Vertex)it.next(); Vertex slideDir = ((Vertex)slideMap.get(vertex)).copy(); ! slideDir.scale(1 / slideDir.length()); double slideScale; if (delta == null) { --- 266,280 ---- if (slideMap != null && slideMap.keySet().containsAll(vertices)) { Vertex directionCopy = direction.copy(); ! directionCopy.scaleInPlace(1 / directionCopy.length()); ! directionCopy.scaleInPlace(delta.dot(directionCopy)); delta = directionCopy; if (delta.length() != 0) { Vertex deltaUnit = delta.copy(); ! deltaUnit.scaleInPlace(1 / delta.length()); Iterator it = vertices.iterator(); while (it.hasNext()) { Vertex vertex = (Vertex)it.next(); Vertex slideDir = ((Vertex)slideMap.get(vertex)).copy(); ! slideDir.scaleInPlace(1 / slideDir.length()); double slideScale; if (delta == null) { *************** *** 294,298 **** slideScale = delta.getZ() / (slideDir.dot(deltaUnit) * deltaUnit.getZ()); } ! slideDir.scale(slideScale); vertex.move(slideDir.getX(), slideDir.getY(), slideDir.getZ()); } --- 294,298 ---- slideScale = delta.getZ() / (slideDir.dot(deltaUnit) * deltaUnit.getZ()); } ! slideDir.scaleInPlace(slideScale); vertex.move(slideDir.getX(), slideDir.getY(), slideDir.getZ()); } Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** ExtrusionTool.java 27 Sep 2007 10:39:43 -0000 1.69 --- ExtrusionTool.java 13 Nov 2007 12:19:22 -0000 1.70 *************** *** 443,447 **** Vertex dir = to.minus(from); dir.normalize(); ! dir.scale(length); to = from.add(dir); } else { --- 443,447 ---- Vertex dir = to.minus(from); dir.normalize(); ! dir.scaleInPlace(length); to = from.add(dir); } else { Index: TapeMeasure.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasure.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TapeMeasure.java 20 Jun 2007 13:17:55 -0000 1.4 --- TapeMeasure.java 13 Nov 2007 12:19:22 -0000 1.5 *************** *** 59,63 **** Vertex projected = current.vertex().minus(origin); double t = normal.dot(projected); ! normal.scale(t); projected = projected.minus(normal); Edge ortho = new Edge(origin, origin.add(projected)); --- 59,63 ---- Vertex projected = current.vertex().minus(origin); double t = normal.dot(projected); ! normal.scaleInPlace(t); projected = projected.minus(normal); Edge ortho = new Edge(origin, origin.add(projected)); *************** *** 156,160 **** Vertex direction = lengthEdge.getDirection(); direction.normalize(); ! direction.scale(value); Vertex origin = start.vertex().add(direction); Line line = new Line(origin, originalEdge.getDirection(), true, false); --- 156,160 ---- Vertex direction = lengthEdge.getDirection(); direction.normalize(); ! direction.scaleInPlace(value); Vertex origin = start.vertex().add(direction); Line line = new Line(origin, originalEdge.getDirection(), true, false); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** AbstractTool.java 12 Nov 2007 08:05:34 -0000 1.135 --- AbstractTool.java 13 Nov 2007 12:19:22 -0000 1.136 *************** *** 298,305 **** 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()); ! up.scale(2 / up.length()); --- 298,305 ---- double z = c.getCenter()[2] - c.getCamera()[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleInPlace(2 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleInPlace(2 / sidewards.length()); ! up.scaleInPlace(2 / up.length()); Index: ArcTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ArcTool.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ArcTool.java 9 Nov 2007 09:45:32 -0000 1.19 --- ArcTool.java 13 Nov 2007 12:19:22 -0000 1.20 *************** *** 85,89 **** Vertex v1 = m.minus(p); ! v1.scale(0.5); Vertex m1 = p.add(v1); --- 85,89 ---- Vertex v1 = m.minus(p); ! v1.scaleInPlace(0.5); Vertex m1 = p.add(v1); *************** *** 92,100 **** v1.setX(-y); v1.setY(x); ! v1.scale(10 / v1.length()); Edge l1 = new Edge(m1.minus(v1), m1.add(v1)); Vertex v2 = m.minus(q); ! v2.scale(0.5); Vertex m2 = q.add(v2); --- 92,100 ---- v1.setX(-y); v1.setY(x); ! v1.scaleInPlace(10 / v1.length()); Edge l1 = new Edge(m1.minus(v1), m1.add(v1)); Vertex v2 = m.minus(q); ! v2.scaleInPlace(0.5); Vertex m2 = q.add(v2); *************** *** 103,107 **** v2.setX(-y); v2.setY(x); ! v2.scale(10 / v2.length()); Edge l2 = new Edge(m2.minus(v2), m2.add(v2)); l1.setStrippled(true); --- 103,107 ---- v2.setX(-y); v2.setY(x); ! v2.scaleInPlace(10 / v2.length()); Edge l2 = new Edge(m2.minus(v2), m2.add(v2)); l1.setStrippled(true); *************** *** 117,121 **** Vertex u1 = p.minus(center); radius = u1.length(); ! u1.scale(1 / radius); tetra1 = Math.acos(u1.getX()); if (u1.getY() < 0) { --- 117,121 ---- Vertex u1 = p.minus(center); radius = u1.length(); ! u1.scaleInPlace(1 / radius); tetra1 = Math.acos(u1.getX()); if (u1.getY() < 0) { *************** *** 123,127 **** } Vertex u2 = q.minus(center); ! u2.scale(1 / radius); tetra2 = Math.acos(u2.getX()); if (u2.getY() < 0) { --- 123,127 ---- } Vertex u2 = q.minus(center); ! u2.scaleInPlace(1 / radius); tetra2 = Math.acos(u2.getX()); if (u2.getY() < 0) { *************** *** 213,217 **** end = current; Vertex between = end.vertex().minus(first.vertex()); ! between.scale(0.5); start = new Intersection(first.vertex().add(between), Intersection.VERTEX, null); } else { --- 213,217 ---- end = current; Vertex between = end.vertex().minus(first.vertex()); ! between.scaleInPlace(0.5); start = new Intersection(first.vertex().add(between), Intersection.VERTEX, null); } else { Index: CameraWalkTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraWalkTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** CameraWalkTool.java 20 Jun 2007 13:17:55 -0000 1.8 --- CameraWalkTool.java 13 Nov 2007 12:19:22 -0000 1.9 *************** *** 83,89 **** 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) { --- 83,89 ---- double z = c.getCenter()[2] - c.getCamera()[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleInPlace(2 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleInPlace(2 / sidewards.length()); if (e.getKeyCode() == KeyEvent.VK_UP) { Index: CameraFlyTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraFlyTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CameraFlyTool.java 20 Jun 2007 13:17:56 -0000 1.10 --- CameraFlyTool.java 13 Nov 2007 12:19:22 -0000 1.11 *************** *** 84,90 **** 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) { --- 84,90 ---- double z = c.getCenter()[2] - c.getCamera()[2]; Vertex forward = new Vertex(x, y, z); ! forward.scaleInPlace(2 / forward.length()); Vertex sidewards = up.cross(forward); ! sidewards.scaleInPlace(2 / sidewards.length()); if (e.getKeyCode() == KeyEvent.VK_UP) { Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** FinalMoveTool.java 8 Nov 2007 08:26:50 -0000 1.31 --- FinalMoveTool.java 13 Nov 2007 12:19:22 -0000 1.32 *************** *** 253,257 **** Vertex v = to.minus(current); double length = v.length(); ! v.scale(1 / length); direction = new Direction(current.copy(), v, Double.NEGATIVE_INFINITY, length); } else { --- 253,257 ---- Vertex v = to.minus(current); double length = v.length(); ! v.scaleInPlace(1 / length); direction = new Direction(current.copy(), v, Double.NEGATIVE_INFINITY, length); } else { *************** *** 299,303 **** } Vertex u = n.copy(); ! u.scale(t); current.set(original.add(u)); } --- 299,303 ---- } Vertex u = n.copy(); ! u.scaleInPlace(t); current.set(original.add(u)); } *************** *** 379,383 **** private void multiply(int i) { Vertex v = direction.copy(); ! v.scale(i); Mesh copy = mesh.copyAndAssign(new HashMap()); for (Vertex current : copy.vertices()) { --- 379,383 ---- private void multiply(int i) { Vertex v = direction.copy(); ! v.scaleInPlace(i); Mesh copy = mesh.copyAndAssign(new HashMap()); for (Vertex current : copy.vertices()) { *************** *** 394,398 **** double d = (double) i * delta; ! v.scale(d / v.length()); Mesh copy = mesh.copyAndAssign(new HashMap()); for (Vertex current : copy.vertices()) { --- 394,398 ---- double d = (double) i * delta; ! v.scaleInPlace(d / v.length()); Mesh copy = mesh.copyAndAssign(new HashMap()); for (Vertex current : copy.vertices()) { Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** AbstractPencil.java 12 Nov 2007 14:47:36 -0000 1.97 --- AbstractPencil.java 13 Nov 2007 12:19:22 -0000 1.98 *************** *** 737,741 **** Vertex v = current.vertex().minus(before); if (v.length() > Geometry.EPS) { ! v.scale(length / v.length()); Vertex to = before.add(v); current = new Intersection(to, Intersection.VERTEX, to); --- 737,741 ---- Vertex v = current.vertex().minus(before); if (v.length() > Geometry.EPS) { ! v.scaleInPlace(length / v.length()); Vertex to = before.add(v); current = new Intersection(to, Intersection.VERTEX, to); Index: AltMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AltMoveTool.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** AltMoveTool.java 29 May 2007 11:49:14 -0000 1.12 --- AltMoveTool.java 13 Nov 2007 12:19:22 -0000 1.13 *************** *** 92,96 **** Vertex normal = system.getN().copy(); double distance = normal.dot(delta); ! normal.scale(distance); Vertex to = from.add(normal); makeTarget(current); --- 92,96 ---- Vertex normal = system.getN().copy(); double distance = normal.dot(delta); ! normal.scaleInPlace(distance); Vertex to = from.add(normal); makeTarget(current); Index: RectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RectTool.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** RectTool.java 9 Nov 2007 09:45:32 -0000 1.24 --- RectTool.java 13 Nov 2007 12:19:22 -0000 1.25 *************** *** 79,84 **** Vertex delta = lastCurrent.minus(current.vertex()); Vertex baseProjection = baseEdge.getDirection(); ! baseProjection.scale(1 / baseProjection.length()); ! baseProjection.scale(delta.dot(baseProjection)); Vertex movement = baseProjection.minus(delta); movingEdge.move(movement.getX(), movement.getY(), movement.getZ()); --- 79,84 ---- Vertex delta = lastCurrent.minus(current.vertex()); Vertex baseProjection = baseEdge.getDirection(); ! baseProjection.scaleInPlace(1 / baseProjection.length()); ! baseProjection.scaleInPlace(delta.dot(baseProjection)); Vertex movement = baseProjection.minus(delta); movingEdge.move(movement.getX(), movement.getY(), movement.getZ()); *************** *** 100,104 **** double length = start.vertex().minus(current.vertex()).length(); Vertex direction = movingEdge.getFrom().minus(baseEdge.getTo()); ! direction.scale((length - direction.length()) / direction.length()); movingEdge.move(direction.getX(), direction.getY(), direction.getZ()); Geometry.insertEdges(rectangle); --- 100,104 ---- double length = start.vertex().minus(current.vertex()).length(); Vertex direction = movingEdge.getFrom().minus(baseEdge.getTo()); ! direction.scaleInPlace((length - direction.length()) / direction.length()); movingEdge.move(direction.getX(), direction.getY(), direction.getZ()); Geometry.insertEdges(rectangle); |