[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Vertex.java,1.32,1.33 Surface.java,1.
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-04-05 14:10:26
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20209/src/net/sourceforge/bprocessor/model Modified Files: Vertex.java Surface.java Log Message: Better hole-analysis Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** Surface.java 5 Apr 2006 10:23:22 -0000 1.87 --- Surface.java 5 Apr 2006 14:10:15 -0000 1.88 *************** *** 621,626 **** while (iter.hasNext()) { Vertex current = (Vertex) iter.next(); ! if (!surrounds(current)) { ! return false; } } --- 621,628 ---- while (iter.hasNext()) { Vertex current = (Vertex) iter.next(); ! if (!onBoundary(current)) { ! if (!surrounds(current)) { ! return false; ! } } } *************** *** 822,825 **** --- 824,855 ---- /** + * Test if vertex is on boundary of this Surfce + * @param v The vertex + * @return True if on boundary + */ + public boolean onBoundary(Vertex v) { + { + List vertices = this.getVertices(); + Iterator iter = vertices.iterator(); + while (iter.hasNext()) { + Vertex vertex = (Vertex) iter.next(); + if (vertex.coincides(v)) { + return true; + } + } + } + { + Iterator iter = edges.iterator(); + while (iter.hasNext()) { + Edge edge = (Edge) iter.next(); + if (edge.coincides(v)) { + return true; + } + } + } + return false; + } + + /** * Tells whether or not a Vertex is contained inside the surface. * @param v the vertex Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Vertex.java 5 Apr 2006 10:23:22 -0000 1.32 --- Vertex.java 5 Apr 2006 14:10:15 -0000 1.33 *************** *** 364,366 **** --- 364,387 ---- return "Vertex"; } + + /** + * Test of the other vertex concides with this vertex + * @param v The vertex + * @return True if coincides + */ + public boolean coincides(Vertex v) { + double dx = v.x - x; + double dy = v.y - y; + double dz = v.z - z; + if (Math.abs(dx) > 0.0000001) { + return false; + } + if (Math.abs(dy) > 0.0000001) { + return false; + } + if (Math.abs(dz) > 0.0000001) { + return false; + } + return true; + } } |