[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Edge.java, 1.80, 1.81 Surface.java,
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Michael L. <he...@us...> - 2007-04-10 08:38:13
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2129/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Surface.java Space.java Log Message: Check functions Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** Surface.java 30 Mar 2007 11:14:04 -0000 1.151 --- Surface.java 10 Apr 2007 07:56:01 -0000 1.152 *************** *** 257,261 **** current = edge.otherVertex(current); if (current == null) { ! throw new Error("the vertex following " + prev + " is null in surface " + this); } } --- 257,262 ---- current = edge.otherVertex(current); if (current == null) { ! return null; ! //throw new Error("the vertex following " + prev + " is null in surface " + this); } } *************** *** 339,342 **** --- 340,347 ---- } setEdges(lst); + Space holeBack = this.getBackDomain(); + Space holeFront = this.getFrontDomain(); + this.setFrontDomain(holeBack); + this.setBackDomain(holeFront); } *************** *** 1112,1122 **** double dot = normal.dot(other); if (dot < 0) { - /* If the normal of the hole is not the same the hole is reversed */ hole.flip(); //FIXME: maybe the holes just shouldnt be flipped - Space holeBack = hole.getBackDomain(); - Space holeFront = hole.getFrontDomain(); - hole.setFrontDomain(holeBack); - hole.setBackDomain(holeFront); } } --- 1117,1122 ---- *************** *** 2070,2072 **** --- 2070,2084 ---- } } + + /** + * + * @return true if consistent + */ + public boolean check() { + Collection<Vertex> vertices = this.getVertices(); + if (vertices == null) { + throw new Error("surface inconsistent"); + } + return true; + } } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.128 retrieving revision 1.129 diff -C2 -d -r1.128 -r1.129 *** Space.java 29 Mar 2007 13:52:04 -0000 1.128 --- Space.java 10 Apr 2007 07:56:01 -0000 1.129 *************** *** 2734,2737 **** --- 2734,2738 ---- } for (Surface surface : mesh.surfaces()) { + surface.check(); surfaces.add(insert(surface)); } Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** Edge.java 29 Mar 2007 13:50:44 -0000 1.80 --- Edge.java 10 Apr 2007 07:56:01 -0000 1.81 *************** *** 1076,1078 **** --- 1076,1098 ---- return cross.length() < 0.000001; } + + /** + * Check consistency + * @return true if ok + */ + public boolean check() { + if (from == null) { + throw new Error("from null"); + } + if (to == null) { + throw new Error ("to null"); + } + if (from == to) { + throw new Error ("from == to"); + } + if (from.equalEps(to)) { + throw new Error ("from overlaps to"); + } + return true; + } } |