Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22852/src/net/sourceforge/bprocessor/model
Modified Files:
Vertex.java Command.java
Log Message:
New scale command
Commented out some setNormals calls
Index: Command.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Command.java 22 Oct 2007 15:21:18 -0000 1.11
--- Command.java 22 Oct 2007 19:26:32 -0000 1.12
***************
*** 233,237 ****
normals.add(normal);
}
! surface.setNormals(normals);
world.insert(surface);
}
--- 233,237 ----
normals.add(normal);
}
! //surface.setNormals(normals);
world.insert(surface);
}
***************
*** 316,320 ****
parameters.put("vertices", vertices);
parameters.put("system", system);
! parameters.put("scale", 1.0);
}
--- 316,322 ----
parameters.put("vertices", vertices);
parameters.put("system", system);
! parameters.put("scale x", 1.0);
! parameters.put("scale y", 1.0);
! parameters.put("scale z", 1.0);
}
***************
*** 323,329 ****
public void evaluate() {
List<Vertex> locals = system.translate(vertices);
! double scale = parameters.getDouble("scale");
for (Vertex current : locals) {
! current.scale(scale);
}
locals = system.unTranslate(locals, false);
--- 325,335 ----
public void evaluate() {
List<Vertex> locals = system.translate(vertices);
! double sx = parameters.getDouble("scale x");
! double sy = parameters.getDouble("scale y");
! double sz = parameters.getDouble("scale z");
for (Vertex current : locals) {
! current.setX(current.getX() * sx);
! current.setY(current.getY() * sy);
! current.setZ(current.getZ() * sz);
}
locals = system.unTranslate(locals, false);
Index: Vertex.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v
retrieving revision 1.65
retrieving revision 1.66
diff -C2 -d -r1.65 -r1.66
*** Vertex.java 3 Oct 2007 10:02:59 -0000 1.65
--- Vertex.java 22 Oct 2007 19:26:32 -0000 1.66
***************
*** 537,540 ****
--- 537,560 ----
}
+ /**
+ * Center
+ * @param vertices collection of vertices
+ * @return center
+ */
+ public static Vertex center(Collection<Vertex> vertices) {
+ double x = 0;
+ double y = 0;
+ double z = 0;
+ for (Vertex current : vertices) {
+ x += current.x;
+ y += current.y;
+ z += current.z;
+ }
+ x /= vertices.size();
+ y /= vertices.size();
+ z /= vertices.size();
+ return new Vertex(x, y, z);
+ }
+
/**
* Project this vertex onto the vertex given as argument
|