[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Surface.java, 1.172, 1.173
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-09-03 16:06:31
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv29864/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Forgot to commit surface for offset functions Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.172 retrieving revision 1.173 diff -C2 -d -r1.172 -r1.173 *** Surface.java 9 Aug 2007 16:07:53 -0000 1.172 --- Surface.java 3 Sep 2007 16:06:28 -0000 1.173 *************** *** 1842,1862 **** * Find the nearest intersection with a edge in the surface * @param vertex the mouse position on the surface * @return the nearest edge */ ! public Edge findClosestEdge(Vertex vertex) { ! Iterator iter = getEdges().iterator(); ! Vertex v = null; ! Edge closest = null; ! double distance = Double.MAX_VALUE; ! while (iter.hasNext()) { ! Edge cur = (Edge)iter.next(); ! Vertex tmp = cur.intersection(vertex); ! if (tmp.minus(vertex).length() < distance) { ! distance = tmp.minus(vertex).length(); ! v = tmp; ! closest = cur; } } - return closest; } --- 1842,1866 ---- * Find the nearest intersection with a edge in the surface * @param vertex the mouse position on the surface + * @param includes the edges to include in the search * @return the nearest edge */ ! public Edge findClosestEdge(Vertex vertex, Collection<? extends Geometric> includes) { ! if (this.getEdges().containsAll(includes)) { ! Vertex v = null; ! Edge closest = null; ! double distance = Double.MAX_VALUE; ! for (Geometric g : includes) { ! Edge cur = (Edge)g; ! Vertex tmp = cur.intersection(vertex); ! if (tmp.minus(vertex).length() < distance) { ! distance = tmp.minus(vertex).length(); ! v = tmp; ! closest = cur; ! } } + return closest; + } else { + return null; } } |