Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2828/src/net/sourceforge/bprocessor/gl/tool
Modified Files:
Protractor.java
Log Message:
Implemented CoordinateSystem.systemFor(origin, normal) that returns an appropriate coordinate system
Index: Protractor.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Protractor.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** Protractor.java 22 Nov 2007 10:12:46 -0000 1.19
--- Protractor.java 22 Nov 2007 10:25:57 -0000 1.20
***************
*** 166,197 ****
*/
public 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);
! }
! }
! 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);
! }
! }
! if (index == Vertex.Z) {
! i = new Vertex(1, 0, 0);
! }
!
! double t = n.dot(i);
!
! i = i.minus(n.scale(t));
! i.normalize();
! j = n.cross(i);
!
! return new CoordinateSystem(i, j, n, origin);
}
--- 166,170 ----
*/
public CoordinateSystem systemFor(Vertex origin, Vertex n) {
! return CoordinateSystem.systemFor(origin, n);
}
|