/** * speed up for short lines * * @param p * @return * @throws ReprapException * @throws IOException */ private boolean shortLine(Rr2Point p, boolean stopExtruder, boolean closeValve) throws ReprapException, IOException { Printer printer = layerConditions.getPrinter(); double shortLen = printer.getExtruder().getShortLength(); if (shortLen < 0) return false; Rr2Point a = Rr2Point.sub(posNow(), p); double amod = a.mod(); if (amod > shortLen) { // Debug.d("Long segment. Current feedrate is: " + currentFeedrate); return false; } // printer.setFeedrate(printer.getExtruder().getShortLineFeedrate()); // TODO: FIX THIS // printer.setSpeed(LinePrinter.speedFix(printer.getExtruder().getXYSpeed(), // printer.getExtruder().getShortSpeed())); printer.printTo( p.x(), p.y(), layerConditions.getMachineZ(), printer.getExtruder().getShortLineFeedrate(), stopExtruder, closeValve); // printer.setFeedrate(currentFeedrate); return true; }
/** * @param before * @param now * @param after * @param fastLength */ public segmentSpeeds(Rr2Point before, Rr2Point now, Rr2Point after, double fastLength) { Rr2Point a = Rr2Point.sub(now, before); double amod = a.mod(); abandon = amod == 0; if (abandon) return; Rr2Point b = Rr2Point.sub(after, now); if (b.mod() == 0) ca = 0; else ca = Rr2Point.mul(a.norm(), b.norm()); plotMiddle = true; if (amod <= 2 * fastLength) { fastLength = amod * 0.5; plotMiddle = false; } a = a.norm(); p1 = Rr2Point.add(before, Rr2Point.mul(a, fastLength)); p2 = Rr2Point.add(p1, Rr2Point.mul(a, amod - 2 * fastLength)); p3 = Rr2Point.add(p2, Rr2Point.mul(a, fastLength)); }