Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19040/src/net/sourceforge/bprocessor/model
Modified Files:
Surface.java Geometry.java
Log Message:
Fixed calculation of normals for surface
Index: Surface.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -d -r1.45 -r1.46
*** Surface.java 15 Nov 2005 18:58:30 -0000 1.45
--- Surface.java 17 Nov 2005 18:10:25 -0000 1.46
***************
*** 751,758 ****
if (edges.size() > 1) {
Vertex i, j, n, origin;
!
Edge e0 = (Edge) edges.get(0);
! Edge e1 = (Edge) edges.get(1);
! return CoordinateSystem.create(e0, e1);
} else {
return null;
--- 751,762 ----
if (edges.size() > 1) {
Vertex i, j, n, origin;
! n = normal();
Edge e0 = (Edge) edges.get(0);
! origin = getFirtVertex();
! i = e0.otherVertex(origin).minus(origin);
! i.scale(1 / i.length());
! j = i.cross(n);
! j.scale(1 / j.length());
! return new CoordinateSystem(i, j, n, origin);
} else {
return null;
Index: Geometry.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Geometry.java 15 Nov 2005 18:58:30 -0000 1.4
--- Geometry.java 17 Nov 2005 18:10:25 -0000 1.5
***************
*** 28,31 ****
--- 28,34 ----
public static Vertex normal(List vertices) {
Vertex normal = normal0(vertices);
+ if (normal == null) {
+ return null;
+ }
Vertex origin = (Vertex) vertices.get(0);
Vertex a = (Vertex) vertices.get(1);
***************
*** 141,146 ****
}
- System.out.println("exterior = " + exterior);
-
Set siblings = to.getEdges();
siblings.remove(first);
--- 144,147 ----
|