[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Vertex.java, 1.78, 1.79 Surface.java
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2009-03-31 11:03:28
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3854/src/net/sourceforge/bprocessor/model Modified Files: Vertex.java Surface.java Container.java Log Message: Automatic assignment Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.222 retrieving revision 1.223 diff -C2 -d -r1.222 -r1.223 *** Surface.java 4 Feb 2009 15:09:52 -0000 1.222 --- Surface.java 31 Mar 2009 11:03:21 -0000 1.223 *************** *** 35,39 **** */ public class Surface extends Geometric implements Parametric { ! private static final boolean AUTOMATIC = false; private static Logger log = Logger.getLogger(Surface.class); --- 35,39 ---- */ public class Surface extends Geometric implements Parametric { ! private static final boolean AUTOMATIC = true; private static Logger log = Logger.getLogger(Surface.class); Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** Vertex.java 21 Jan 2008 13:37:25 -0000 1.78 --- Vertex.java 31 Mar 2009 11:03:21 -0000 1.79 *************** *** 558,562 **** } - /** * --- 558,561 ---- *************** *** 578,583 **** } ! ! /** * Center --- 577,627 ---- } ! /** ! * ! * @param a double ! * @param b double ! * @return true if considered equal within some small value ! */ ! public static boolean eq(double a, double b) { ! return Math.abs(a - b) < 0.00001; ! } ! ! /** ! * Sort ! * @param vertices list of vertices to sort ! */ ! public static void sort(List<Vertex> vertices) { ! Comparator<Vertex> comparator = new Comparator<Vertex>() { ! public int compare(Vertex v1, Vertex v2) { ! if (eq(v1.x, v2.x)) { ! if (eq(v1.y, v2.y)) { ! if (eq(v1.z, v2.z)) { ! return 0; ! } else { ! if (v1.z < v2.z) { ! return -1; ! } else { ! return 1; ! } ! } ! } else { ! if (v1.y < v2.y) { ! return -1; ! } else { ! return 1; ! } ! } ! } else { ! if (v1.x < v2.x) { ! return -1; ! } else { ! return 1; ! } ! } ! } ! }; ! Collections.sort(vertices, comparator); ! } ! /** * Center Index: Container.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Container.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Container.java 3 Nov 2008 13:14:09 -0000 1.17 --- Container.java 31 Mar 2009 11:03:21 -0000 1.18 *************** *** 11,15 **** import java.util.Collection; import java.util.Collections; - import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; --- 11,14 ---- *************** *** 1127,1133 **** } ! private static boolean eq(double a, double b) { ! return Math.abs(a - b) < 0.00001; ! } /** --- 1126,1130 ---- } ! /** *************** *** 1151,1188 **** public void simplify() { { - Comparator<Vertex> comparator = new Comparator<Vertex>() { - public int compare(Vertex v1, Vertex v2) { - if (eq(v1.x, v2.x)) { - if (eq(v1.y, v2.y)) { - if (eq(v1.z, v2.z)) { - return 0; - } else { - if (v1.z < v2.z) { - return -1; - } else { - return 1; - } - } - } else { - if (v1.y < v2.y) { - return -1; - } else { - return 1; - } - } - } else { - if (v1.x < v2.x) { - return -1; - } else { - return 1; - } - } - } - }; List<Vertex> sorted = new LinkedList(getVertices()); ! Collections.sort(sorted, comparator); Collection<Collection<Vertex>> equivalences = new LinkedList(); { ! //Remove eqivalent vertexes Vertex leader = null; Collection<Vertex> equivalence = null; --- 1148,1156 ---- public void simplify() { { List<Vertex> sorted = new LinkedList(getVertices()); ! Vertex.sort(sorted); Collection<Collection<Vertex>> equivalences = new LinkedList(); { ! // Remove equivalent vertexes Vertex leader = null; Collection<Vertex> equivalence = null; |