Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4082/src/net/sourceforge/bprocessor/model
Modified Files:
Surface.java
Log Message:
fixed normal calculation
Index: Surface.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v
retrieving revision 1.136
retrieving revision 1.137
diff -C2 -d -r1.136 -r1.137
*** Surface.java 13 Feb 2007 15:05:14 -0000 1.136
--- Surface.java 16 Feb 2007 09:50:21 -0000 1.137
***************
*** 596,600 ****
vertices.toArray(v);
edges.toArray(e);
!
for (int i = 0; i < n; i++) {
vmap[i] = v[i].copy().add(normal);
--- 596,600 ----
vertices.toArray(v);
edges.toArray(e);
!
for (int i = 0; i < n; i++) {
vmap[i] = v[i].copy().add(normal);
***************
*** 630,640 ****
top = new Surface(newEdges);
}
!
// FIXME should return the sides instead of assigning
// spaces here.
boolean flip = false;
boolean inside = false;
!
!
if (exterior != null) {
Vertex n0 = normal();
--- 630,639 ----
top = new Surface(newEdges);
}
!
// FIXME should return the sides instead of assigning
// spaces here.
boolean flip = false;
boolean inside = false;
!
if (exterior != null) {
Vertex n0 = normal();
***************
*** 1112,1117 ****
hole.setBackDomain(back);
}
- //changed();
- //hole.changed();
}
--- 1111,1114 ----
***************
*** 1149,1177 ****
}
}
- /* NOT THE JOB FOR SURFACE
- if (exterior != null) {
- if (!exterior.surrounds(this)) {
- log.info("Did move the surface back");
- //The inner surface has been moved out of its outer surface
- //this can not happen so here we move the inner surface back
- {
- List vertices = getVertices();
- Iterator iter = vertices.iterator();
- while (iter.hasNext()) {
- Vertex vertex = (Vertex) iter.next();
- vertex.move(-dx, -dy, -dz);
- }
- }
- {
- if (getHoles() != null) {
- Iterator iter = getHoles().iterator();
- while (iter.hasNext()) {
- Surface surface = (Surface) iter.next();
- surface.move(-dx, -dy, -dz);
- }
- }
- }
- }
- }*/
}
--- 1146,1149 ----
***************
*** 1418,1422 ****
public Vertex normal() {
return normal0();
- //return Geometry.normal(getVertices());
}
--- 1390,1393 ----
***************
*** 1468,1471 ****
--- 1439,1443 ----
}
}
+
double[] coord;
if (y > x) {
***************
*** 1490,1496 ****
}
}
! int inx0 = inx1 == 0 ? e.length - 1 : inx1 - 1;
int inx2 = (inx1 + 1) % e.length;
vx = xs[inx1] - xs[inx0];
vy = ys[inx1] - ys[inx0];
--- 1462,1476 ----
}
}
!
! int inx0 = inx1 == 0 ? e.length - 1 : inx1 - 1;
int inx2 = (inx1 + 1) % e.length;
+ for (int i = 0; i < e.length; i++) {
+ if (coord[inx1] < coord[(inx2 + i) % e.length]) {
+ inx2 = (inx2 + i) % e.length;
+ break;
+ }
+ }
+
vx = xs[inx1] - xs[inx0];
vy = ys[inx1] - ys[inx0];
***************
*** 1508,1512 ****
y = y / length;
z = z / length;
-
return new Vertex(x, y, z);
}
--- 1488,1491 ----
|