[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Command.java, 1.21, 1.22
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-11-08 09:11:26
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23683/src/net/sourceforge/bprocessor/model Modified Files: Command.java Log Message: Simplification of the subdivide command Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Command.java 5 Nov 2007 18:08:54 -0000 1.21 --- Command.java 8 Nov 2007 09:11:29 -0000 1.22 *************** *** 308,312 **** * */ ! public static class SmoothSpace extends Command { /** --- 308,312 ---- * */ ! public static class Subdivide extends Command { /** *************** *** 314,321 **** * @param space Space */ ! public SmoothSpace(Space space) { parameters.put("space", space); ! parameters.putDouble("n", 2); ! parameters.putBoolean("envelope", true); } --- 314,320 ---- * @param space Space */ ! public Subdivide(Space space) { parameters.put("space", space); ! parameters.putDouble("n", 1); } *************** *** 480,524 **** Space space = (Space) parameters.get("space"); int n = (int) parameters.getDouble("n"); - boolean envelope = parameters.getBoolean("envelope"); ! List<Surface> faces; ! if (envelope) { ! faces = new ArrayList(space.getEnvelope()); ! } else { ! faces = new ArrayList(space.getSurfaces()); ! } for (int i = 0; i < n; i++) { faces = subdivide(faces); } ! if (envelope) { ! Collection<Surface> env = new LinkedList(space.getEnvelope()); ! for (Surface current : env) { ! current.erase(); ! } ! Space owner = space.getOwner(); ! for (Surface quad : faces) { ! owner.insert(quad); ! } ! } else { ! space.clear(); ! for (Surface quad : faces) { ! for (Edge current : quad.getEdges()) { ! if (current.from.getOwner() == null) { ! space.add(current.from); ! } ! if (current.to.getOwner() == null) { ! space.add(current.to); ! } ! if (current.getOwner() == null) { ! space.add(current); ! } } - space.add(quad); } } - - Project.getInstance().changed(Project.getInstance()); } --- 479,505 ---- Space space = (Space) parameters.get("space"); int n = (int) parameters.getDouble("n"); ! List<Surface> faces = new ArrayList(space.getSurfaces()); ! for (int i = 0; i < n; i++) { faces = subdivide(faces); } ! space.clear(); ! for (Surface quad : faces) { ! for (Edge current : quad.getEdges()) { ! if (current.from.getOwner() == null) { ! space.add(current.from); ! } ! if (current.to.getOwner() == null) { ! space.add(current.to); ! } ! if (current.getOwner() == null) { ! space.add(current); } } + space.add(quad); } Project.getInstance().changed(Project.getInstance()); } |