[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model CoordinateSystem.java, 1.72, 1.73
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-12-17 18:35:36
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3948/src/net/sourceforge/bprocessor/model Modified Files: CoordinateSystem.java Log Message: removed side effects from translate(coordinatesystem), and changed systemFor to use the active coordinatesystem when aligning with a normal and a origin... Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** CoordinateSystem.java 17 Dec 2007 13:09:16 -0000 1.72 --- CoordinateSystem.java 17 Dec 2007 18:35:22 -0000 1.73 *************** *** 151,160 **** */ public static CoordinateSystem systemFor(Vertex origin, Vertex n) { int index = n.largestCoefficient(); Vertex i = null; Vertex j = null; if (index == Vertex.X) { i = new Vertex(0, 1, 0); ! Vertex z = new Vertex(1, 0, 0); if (n.dot(z) < 0) { i = i.scale(-1); --- 151,162 ---- */ public static CoordinateSystem systemFor(Vertex origin, Vertex n) { + CoordinateSystem activeCoordinates = Project.getInstance().getActiveCoordinateSystem(); int index = n.largestCoefficient(); + Vertex i = null; Vertex j = null; if (index == Vertex.X) { i = new Vertex(0, 1, 0); ! Vertex z = activeCoordinates.getI(); if (n.dot(z) < 0) { i = i.scale(-1); *************** *** 163,167 **** if (index == Vertex.Y) { i = new Vertex(-1, 0, 0); ! Vertex z = new Vertex(0, 1, 0); if (n.dot(z) < 0) { i = i.scale(-1); --- 165,169 ---- if (index == Vertex.Y) { i = new Vertex(-1, 0, 0); ! Vertex z = activeCoordinates.getJ(); if (n.dot(z) < 0) { i = i.scale(-1); *************** *** 169,173 **** } if (index == Vertex.Z) { ! i = new Vertex(1, 0, 0); } --- 171,175 ---- } if (index == Vertex.Z) { ! i = activeCoordinates.getI(); } *************** *** 622,642 **** double y = j.dot(newI); double z = n.dot(newI); ! newI.setX(x); ! newI.setY(y); ! newI.setZ(z); ! Vertex newJ = coordinate.j; x = i.dot(newJ); y = j.dot(newJ); z = n.dot(newJ); ! newJ.setX(x); ! newJ.setY(y); ! newJ.setZ(z); ! Vertex newN = coordinate.n; x = i.dot(newN); y = j.dot(newN); z = n.dot(newN); ! newN.setX(x); ! newN.setY(y); ! newN.setZ(z); Vertex origin = translate(coordinate.origin); return new CoordinateSystem(newI, newJ, newN, origin); --- 624,638 ---- double y = j.dot(newI); double z = n.dot(newI); ! newI = new Vertex(x, y, z); ! Vertex newJ = coordinate.j.copy(); x = i.dot(newJ); y = j.dot(newJ); z = n.dot(newJ); ! newJ = new Vertex(x, y, z); ! Vertex newN = coordinate.n.copy(); x = i.dot(newN); y = j.dot(newN); z = n.dot(newN); ! newN = new Vertex(x, y, z); Vertex origin = translate(coordinate.origin); return new CoordinateSystem(newI, newJ, newN, origin); |