[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Geometry.java, 1.54, 1.55
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Nordholt <nor...@us...> - 2007-05-07 15:42:42
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31590/src/net/sourceforge/bprocessor/model Modified Files: Geometry.java Log Message: Made a method for moving vertices by untranslating them in to a local coordinate system Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** Geometry.java 7 May 2007 13:33:12 -0000 1.54 --- Geometry.java 7 May 2007 15:42:42 -0000 1.55 *************** *** 965,968 **** --- 965,989 ---- } } + } + + /** + * Untranslates all vertices of a set of geometry, and changes the + * coordinates of the vertices accordingly. Notice this is likely to + * move the geometry. + * @param geometry the geometry + * @param system the coordinate system to untranslate according to + */ + public static void unTranslateGeometry(Set geometry, CoordinateSystem system) { + List<Vertex> vertices = new LinkedList<Vertex>(collect(geometry)); + List<Vertex> unTranslatedVertices = system.unTranslate(vertices); + Iterator it = vertices.iterator(); + Iterator unTranslatedIt = unTranslatedVertices.iterator(); + while (it.hasNext() && unTranslatedIt.hasNext()) { + Vertex v = (Vertex)it.next(); + Vertex vUnTranslated = (Vertex)unTranslatedIt.next(); + v.setX(vUnTranslated.getX()); + v.setY(vUnTranslated.getY()); + v.setZ(vUnTranslated.getZ()); + } } } |