public BooleanGridList offset(LayerRules lc, boolean outline) { boolean foundation = lc.getLayingSupport(); if (outline && foundation) Debug.e("Offsetting a foundation outline!"); BooleanGridList result = new BooleanGridList(); for (int i = 0; i < size(); i++) { Attributes att = attribute(i); if (att == null) Debug.e("BooleanGridList.offset(): null attribute!"); else { Extruder[] es = lc.getPrinter().getExtruders(); Extruder e; int shells; if (foundation) { e = es[0]; // By convention extruder 0 builds the foundation shells = 1; } else { e = att.getExtruder(); shells = e.getShells(); } if (outline) { for (int shell = 0; shell < shells; shell++) result.add(get(i).offset(-((double) shell + 0.5) * e.getExtrusionSize()), att); } else { // Must be a hatch. Only do it if the gap is +ve or we're building the foundation double offSize; if (foundation) offSize = 3; else offSize = -((double) shells + 0.5) * e.getExtrusionSize() + e.getInfillOverlap(); if (e.getExtrusionInfillWidth() > 0 || foundation) // Z valuesn't mattere here result.add(get(i).offset(offSize), att); } } } return result; }
/** * Work out all the open polygond forming a set of infill hatches * * @param layerConditions * @return */ public RrPolygonList hatch(LayerRules layerConditions) { RrPolygonList result = new RrPolygonList(); boolean foundation = layerConditions.getLayingSupport(); Extruder[] es = layerConditions.getPrinter().getExtruders(); for (int i = 0; i < size(); i++) { Extruder e; if (foundation) e = es[0]; // Extruder 0 is used for foundations else e = attribute(i).getExtruder(); result.add( get(i) .hatch( layerConditions.getHatchDirection(e), layerConditions.getHatchWidth(e), attribute(i))); } return result; }