[Bprocessor-commit] facade/src/net/sourceforge/bprocessor/facade/modellor FacadeModellor.java, 1.6
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2006-08-31 11:25:08
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv676/src/net/sourceforge/bprocessor/facade/modellor Modified Files: FacadeModellor.java Log Message: All holes for windows should now have the same dimensions, also the facade should now be correct no matter the orientation of the front surface. Index: FacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/FacadeModellor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FacadeModellor.java 29 Aug 2006 09:44:50 -0000 1.6 --- FacadeModellor.java 31 Aug 2006 11:24:55 -0000 1.7 *************** *** 25,29 **** import org.apache.log4j.Logger; - /** * The facade modellor models the elements for a facade space. --- 25,28 ---- *************** *** 306,310 **** h.setFrontDomain(space.getEmpty()); Set sides = new HashSet(); ! frameSurfaces.add(eFront.extrude(depth, sides)); frameSurfaces.addAll(sides); Iterator sidesIt = sides.iterator(); --- 305,309 ---- h.setFrontDomain(space.getEmpty()); Set sides = new HashSet(); ! frameSurfaces.add(extrudeIntoSpace(eFront, depth, sides)); frameSurfaces.addAll(sides); Iterator sidesIt = sides.iterator(); *************** *** 313,317 **** } sides = new HashSet(); ! Surface top = h.extrude(depth, sides); windows.add(top); Geometry.holeAnalysis(top); --- 312,316 ---- } sides = new HashSet(); ! Surface top = extrudeIntoSpace(h, depth, sides); windows.add(top); Geometry.holeAnalysis(top); *************** *** 374,401 **** horCons = new LinkedList(); Vertex offset = horDir.copy(); ! double intervalV = ((horEdge.getLength() - frameThickness * 2) + vertPostWidth) ! / (vertPosts + 1); ! for (int i = 1; i < vertPosts + 1; i++) { ! if (i > 1) { ! offset.scale((intervalV * i + frameThickness) / offset.length()); ! } else { ! offset.scale(((intervalV - vertPostWidth / 2) * i + frameThickness) ! / offset.length()); ! } Line l = new Line(cross.add(offset), vertDir.copy(), true); vertCons.add(l); space.add(l); } offset = vertDir.copy(); ! double intervalH = (vertEdge.getLength() - (frameThickness * 2) + horPostWidth) ! / (horPosts + 1); ! for (int i = 1; i < horPosts + 1; i++) { ! if (i > 1) { ! offset.scale((intervalH * i + frameThickness) / offset.length()); ! } else { ! offset.scale(((intervalH - horPostWidth / 2) * i + frameThickness) ! / offset.length()); ! } Line l = new Line(cross.add(offset), horDir.copy(), true); horCons.add(l); space.add(l); --- 373,396 ---- horCons = new LinkedList(); Vertex offset = horDir.copy(); ! double intervalV = ((horEdge.getLength() - frameThickness * 2) - ! vertPostWidth * vertPosts) / (vertPosts + 1); ! double lengthV = intervalV + frameThickness; ! for (int i = 0; i < vertPosts; i++) { ! lengthV += (vertPostWidth / 2); ! offset.scale(lengthV / offset.length()); Line l = new Line(cross.add(offset), vertDir.copy(), true); + lengthV += (intervalV + (vertPostWidth / 2)); vertCons.add(l); space.add(l); } offset = vertDir.copy(); ! double intervalH = ((vertEdge.getLength() - frameThickness * 2) - ! horPostWidth * horPosts) / (horPosts + 1); ! double lengthH = intervalH + frameThickness; ! for (int i = 0; i < horPosts; i++) { ! lengthH += (horPostWidth / 2); ! offset.scale(lengthH / offset.length()); Line l = new Line(cross.add(offset), horDir.copy(), true); + lengthH += (intervalH + (horPostWidth / 2)); horCons.add(l); space.add(l); *************** *** 490,494 **** Geometry.holeAnalysis(s); Set sides = new HashSet(); ! Surface t = s.extrude(depth, sides); windows.add(t); windows.addAll(sides); --- 485,489 ---- Geometry.holeAnalysis(s); Set sides = new HashSet(); ! Surface t = extrudeIntoSpace(s, depth, sides); windows.add(t); windows.addAll(sides); *************** *** 509,511 **** --- 504,524 ---- } } + /** + * Makes sure to extrude the a surface to the right side + * (towards the space of this modellor). + * @param s the surface + * @param delta the length to extrude + * @param sides this set will hold the sides of the extrusion + * @return the top surface of the extrusion + */ + private Surface extrudeIntoSpace(Surface s, double delta, Set sides) { + int deltaCorrection = 1; + if (s.normal().dot(front.normal()) < 0) { + deltaCorrection *= -1; + } + if (front.getFrontDomain() != space) { + deltaCorrection *= -1; + } + return s.extrude(delta * deltaCorrection, sides); + } } |