[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Surface.java,1.68,1.69 Mesh.java,1.7,
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-02-02 10:53:54
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14232/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Mesh.java Log Message: Clean up in Surface Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** Surface.java 1 Feb 2006 11:45:25 -0000 1.68 --- Surface.java 2 Feb 2006 10:53:44 -0000 1.69 *************** *** 8,12 **** import java.util.ArrayList; - import java.util.Collection; import java.util.HashMap; import java.util.Iterator; --- 8,11 ---- *************** *** 54,65 **** private Surface exterior; - /** Surface is clockwise */ - - public static final int CLOCKWISE = 1; - - /** Surface is counter clock wise **/ - - public static final int COUNTER_CLOCKWISE = 2; - /** * Constructor for surface --- 53,56 ---- *************** *** 238,242 **** * front and back of this Surface. */ ! void flip() { List lst = new ArrayList(edges.size()); Edge[] edges = new Edge[getEdges().size()]; --- 229,233 ---- * front and back of this Surface. */ ! public void flip() { List lst = new ArrayList(edges.size()); Edge[] edges = new Edge[getEdges().size()]; *************** *** 296,309 **** } - /** - * Calculate the turn direction of the vertices of this - * surface. Return values are CLOCKWISE or COUNTER_CLOCKWISE. - * @return The turn direction. - */ - public int direction() { - - return 0; - } - /** * Compute the traversed angle of this Surface --- 287,290 ---- *************** *** 560,564 **** */ public void move(double dx, double dy, double dz) { ! { List vertices = getVertices(); Vertex v0 = (Vertex) vertices.get(0); --- 541,545 ---- */ public void move(double dx, double dy, double dz) { ! { List vertices = getVertices(); Vertex v0 = (Vertex) vertices.get(0); *************** *** 583,622 **** // FIXME: Reimplement this without looking at all surfaces in the mesh ! if (this.isInner()) { ! Collection surfaces = getMesh().getSurfaces(); ! Iterator surfIt = surfaces.iterator(); ! while (surfIt.hasNext()) { ! Surface surf = (Surface)surfIt.next(); ! Set inners = surf.getHoles(); ! if (inners != null) { ! Iterator innerIt = inners.iterator(); ! while (innerIt.hasNext()) { ! Surface innerSurf = (Surface)innerIt.next(); ! if (innerSurf == this) { ! if (!containedCheck(this, surf)) { ! //The inner surface has been moved out of its outer surface ! //this can not happen so here we move the inner surface back ! { ! List vertices = getVertices(); ! Vertex v0 = (Vertex) vertices.get(0); ! v0.move(-dx, -dy, -dz); ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! Vertex vertex = (Vertex) iter.next(); ! if (vertex != v0) { ! vertex.move(-dx, -dy, -dz); ! } ! } ! } ! { ! if (getHoles() != null) { ! Iterator iter = getHoles().iterator(); ! while (iter.hasNext()) { ! Surface surface = (Surface) iter.next(); ! surface.move(-dx, -dy, -dz); ! } ! } ! } ! } } } --- 564,589 ---- // FIXME: Reimplement this without looking at all surfaces in the mesh ! if (exterior != null) { ! if (!exterior.surrounds(this)) { ! //The inner surface has been moved out of its outer surface ! //this can not happen so here we move the inner surface back ! { ! List vertices = getVertices(); ! Vertex v0 = (Vertex) vertices.get(0); ! v0.move(-dx, -dy, -dz); ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! Vertex vertex = (Vertex) iter.next(); ! if (vertex != v0) { ! vertex.move(-dx, -dy, -dz); ! } ! } ! } ! { ! if (getHoles() != null) { ! Iterator iter = getHoles().iterator(); ! while (iter.hasNext()) { ! Surface surface = (Surface) iter.next(); ! surface.move(-dx, -dy, -dz); } } *************** *** 627,647 **** } - - /** - * Checks if a hole is contained in a surface, given that the hole and the - * surface is in the same plane. - * @param hole the hole - * @param surf the surface - * @return boolean indicating werther or not the hole is contained in the plane. - */ - private boolean containedCheck(Surface hole, Surface surf) { - Iterator vertIt = hole.getVertices().iterator(); - boolean contained = true; - while (vertIt.hasNext() && contained) { - contained = surf.surrounds((Vertex)vertIt.next(), 1); - } - return contained; - } - /** * Tests if a surface is a hole in this surface --- 594,597 ---- *************** *** 794,827 **** /** - * Returns the normal to this - * @return A vector normal for this surface, null if the surface consists of only one edge - */ - public Vertex normal1() { - if (edges.size() > 1) { - Edge e1 = (Edge)edges.get(0); - Edge e2 = (Edge)edges.get(1); - Vertex v1 = e1.getFrom(); - Vertex v2 = e1.getTo(); - Vertex v3 = null; - - if (e2.otherVertex(v1) == null) { - v3 = e2.otherVertex(v2); - // v2 is the center - Vertex v2v1 = v2.minus(v1); - Vertex v2v3 = v2.minus(v3); - return v2v3.cross(v2v1); - } else if (e2.otherVertex(v2) == null) { - // v1 is the center - v3 = e2.otherVertex(v1); - Vertex v1v2 = v1.minus(v2); - Vertex v1v3 = v1.minus(v3); - return v1v3.cross(v1v2); - } - return null; - } - return null; - } - - /** * Returns the outward pointing normal to this Surface * @return A vector normal for this surface, null if the surface consists of only one edge --- 744,747 ---- *************** *** 871,899 **** } } - /** - * Returns the projection on the surface normal - * @param p The point to project on the normal - * @return the projection - */ - public Vertex projection(double[] p) { - if (edges.size() > 0) { - Iterator it = edges.iterator(); - Vertex from = ((Edge)it.next()).getTo(); - Vertex point = new Vertex(); - point.setX(p[0] - from.getX()); - point.setY(p[1] - from.getY()); - point.setZ(p[2] - from.getZ()); - Vertex normal = normal(); - double dot = normal.dot(point); - double length = normal.length(); - double scale = dot / (length * length); - normal.scale(scale); - return normal; - } - return null; - } - - /** * Checks if e is in the surface --- 791,795 ---- Index: Mesh.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Mesh.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Mesh.java 1 Feb 2006 11:45:25 -0000 1.7 --- Mesh.java 2 Feb 2006 10:53:44 -0000 1.8 *************** *** 11,14 **** --- 11,15 ---- import java.util.HashMap; import java.util.Iterator; + import java.util.LinkedList; import java.util.List; import java.util.Set; *************** *** 160,167 **** --- 161,183 ---- if (edge.getId() != null) { Set surfaces = edge.getSurfaces(); + Vertex to = edge.getTo(); Vertex from = edge.getFrom(); remove(edge); + + { + List partions = new LinkedList(); + List work = new LinkedList(surfaces); + while (!work.isEmpty()) { + Iterator iter = work.iterator(); + Surface first = (Surface) iter.next(); + CoordinateSystem system = first.coordinateSystem(); + List partion = new LinkedList(); + + } + } + + Iterator it = surfaces.iterator(); while (it.hasNext()) { |