Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23074
Modified Files:
Surface.java
Log Message:
fixed so that the surface normal almost always is pointing towards the camera so that both sides are lit
Index: Surface.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** Surface.java 8 Sep 2005 10:42:14 -0000 1.21
--- Surface.java 14 Sep 2005 06:47:47 -0000 1.22
***************
*** 314,326 ****
public Vertex normal() {
if (edges.size() > 1) {
! Edge e0 = (Edge) edges.get(0);
! Edge e1 = (Edge) edges.get(1);
! Vertex v0 = e0.getTo().minus(e0.getFrom());
! Vertex v1 = e1.getTo().minus(e1.getFrom());
! return v0.cross(v1);
! } else {
return null;
}
}
/**
* Returns the Plane that this Surface lies in
--- 314,341 ----
public Vertex normal() {
if (edges.size() > 1) {
! Edge e1 = (Edge)edges.get(0);
! Edge e2 = (Edge)edges.get(1);
! Vertex v1 = e1.getFrom();
! Vertex v2 = e1.getTo();
! Vertex v3 = null;
!
! if (e2.otherVertex(v1) == null) {
! v3 = e2.otherVertex(v2);
! // v2 is the center
! Vertex v2v1 = v2.minus(v1);
! Vertex v2v3 = v2.minus(v3);
! return v2v3.cross(v2v1);
! } else if (e2.otherVertex(v2) == null) {
! // v1 is the center
! v3 = e2.otherVertex(v1);
! Vertex v1v2 = v1.minus(v2);
! Vertex v1v3 = v1.minus(v3);
! return v1v3.cross(v1v2);
! }
return null;
}
+ return null;
}
+
/**
* Returns the Plane that this Surface lies in
|