Пример #1
0
  // public LayerProducer(BooleanGridList bgPols, LayerRules lc, RrGraphics simPlot) throws
  // Exception
  public LayerProducer(RrPolygonList ap[], LayerRules lc, RrGraphics simPlot) throws Exception {
    layerConditions = lc;
    startNearHere = null;
    // lowerShell = ls;
    // shellSet = false;
    simulationPlot = simPlot;

    allPolygons = ap;

    // boolGrdSlice = bgPols;

    // The next two are experimental for the moment...

    // inFillCalculations();
    // supportCalculations();

    // offHatch = boolGrdSlice.offset(layerConditions, false);

    //		if(layerConditions.getLayingSupport())
    //		{
    //			borderPolygons = null;
    //			offHatch = offHatch.union(lc.getPrinter().getExtruders());
    //		} else
    //		{
    //			BooleanGridList offBorder = boolGrdSlice.offset(layerConditions, true);
    //			borderPolygons = offBorder.borders();
    //		}
    //
    //		hatchedPolygons = offHatch.hatch(layerConditions);
    //
    //
    //		if(borderPolygons != null && borderPolygons.size() > 0)
    //		{
    //			borderPolygons.middleStarts(hatchedPolygons, layerConditions);
    //			if(Preferences.loadGlobalBool("Shield"))
    //			{
    //				RrRectangle rr = lc.getBox();
    //				Rr2Point corner = Rr2Point.add(rr.sw(), new Rr2Point(-3, -3));
    //				RrPolygon ell = new RrPolygon(borderPolygons.polygon(0).getAttributes(), false);
    //				ell.add(corner);
    //				ell.add(Rr2Point.add(corner, new Rr2Point(-2, 10)));
    //				ell.add(Rr2Point.add(corner, new Rr2Point(-2, -2)));
    //				ell.add(Rr2Point.add(corner, new Rr2Point(20, -2)));
    //				borderPolygons.add(0, ell);
    //			}
    //		}

    if (simulationPlot != null) {
      if (!simulationPlot.isInitialised()) {
        RrRectangle rec = lc.getBox();
        if (Preferences.loadGlobalBool("Shield"))
          rec.expand(
              Rr2Point.add(
                  rec.sw(), new Rr2Point(-7, -7))); // TODO: Yuk - this should be a parameter
        simulationPlot.init(rec, false);
      } else simulationPlot.cleanPolygons();
    }
  }
Пример #2
0
 /**
  * @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));
 }