예제 #1
0
파일: layer.cpp 프로젝트: keesj/repsnapper
// add full fill and subtract them from normal fill polys
void Layer::addFullPolygons(const vector<Poly> &newpolys, bool decor)
{
  if (newpolys.size()==0) return;
  Clipping clipp;
  clipp.clear();
  // full fill only where already normal fill
  clipp.addPolys(fillPolygons,subject);
  if (decor) clipp.addPolys(fullFillPolygons,subject);
  clipp.addPolys(newpolys,clip);
  clipp.setZ(Z);
  vector<Poly> inter = clipp.intersect();
  vector<Poly> normals = clipp.subtractMerged(thickness/2.);
  if (decor) {//  && LayerNo != 0) // no decor on base layers
    decorPolygons.insert(decorPolygons.end(), inter.begin(), inter.end());
    Clipping clipp;
    clipp.addPolys(fullFillPolygons,subject);
    clipp.addPolys(inter,clip);
    clipp.setZ(Z);
    setFullFillPolygons(clipp.subtract());
  }
  else {
    fullFillPolygons.insert(fullFillPolygons.end(),inter.begin(),inter.end());
  }

  setNormalFillPolygons(normals);
  //  mergeFullPolygons(false); // done separately
}
예제 #2
0
// add bridge polys and substract them from normal and full fill polys 
void Layer::addBridgePolygons(const vector<Poly> newpolys) 
{
  if (newpolys.size()==0) return;
  bridgePolygons.clear();
  Clipping clipp;
  clipp.clear();
  clipp.addPolys(fillPolygons,subject); 
  clipp.addPolys(newpolys,clip);
  vector<Poly> inter = clipp.intersect();
  bridgePolygons= inter;//.insert(bridgePolygons.end(),inter.begin(),inter.end());
  clipp.clear();
  clipp.addPolys(fillPolygons,subject);  
  clipp.addPolys(inter,clip);
  setNormalFillPolygons(clipp.substract());
  mergeFullPolygons(true);
}
예제 #3
0
// add full fill and substract them from normal fill polys 
void Layer::addFullPolygons(const vector<Poly> newpolys, bool decor) 
{
  if (newpolys.size()==0) return;
  Clipping clipp;
  clipp.clear();
  // full fill only where already normal fill
  clipp.addPolys(fillPolygons,subject); 
  clipp.addPolys(newpolys,clip);
  vector<Poly> inter = clipp.intersect();
  if (decor)
    decorPolygons.insert(decorPolygons.end(),inter.begin(),inter.end());
  else
    fullFillPolygons.insert(fullFillPolygons.end(),inter.begin(),inter.end());

  //substract from normal fills
  clipp.clear();
  clipp.addPolys(fillPolygons,subject);  
  clipp.addPolys(inter,clip);
  setNormalFillPolygons(clipp.substract());
  mergeFullPolygons(false);
}
예제 #4
0
파일: layer.cpp 프로젝트: keesj/repsnapper
// add bridge polys and subtract them from normal and full fill polys
// each given ExPoly is a single bridge with its holes
void Layer::addBridgePolygons(const vector<ExPoly> &newexpolys)
{
  // clip against normal fill and make these areas into bridges:
  Clipping clipp;
  uint num_bridges = newexpolys.size();
  if (num_bridges==0) return;
  clipp.clear();
  bridgePolygons.clear();
  for (uint i=0; i < num_bridges; i++){
    vector<Poly> newpolys = Clipping::getPolys(newexpolys[i]);
    clipp.clear();
    clipp.addPolys(fillPolygons,subject);
    clipp.addPolys(newpolys, clip);
    vector<ExPoly> exbridges = clipp.ext_intersect();
    bridgePolygons.insert(bridgePolygons.end(),exbridges.begin(),exbridges.end());
  }
  // subtract from normal fill
  clipp.clear();
  clipp.addPolys(fillPolygons,subject);
  clipp.addPolys(newexpolys, clip);
  setNormalFillPolygons(clipp.subtract());
}
예제 #5
0
파일: layer.cpp 프로젝트: keesj/repsnapper
void Layer::mergeFullPolygons(bool bridge)
{
  // if (bridge) {
  //   // setBridgePolygons(Clipping::getMerged(bridgePolygons, thickness));
  //   // clipp.addPolys(bridgePolygons,clip);
  // } else {
  //subtract decor from full
  Clipping clipp;
  // clipp.addPolys(fullFillPolygons,subject);
  // clipp.addPolys(decorPolygons,clip);
  // setFullFillPolygons(clipp.subtract());

  setFullFillPolygons(Clipping::getMerged(fullFillPolygons, thickness));
  cleanup(fullFillPolygons, thickness/CLEANFACTOR);
  //subtract from normal fills
  clipp.clear();
  cleanup(fillPolygons, thickness/CLEANFACTOR);
  clipp.addPolys(fillPolygons,subject);
  clipp.addPolys(fullFillPolygons,clip);
  clipp.addPolys(decorPolygons,clip);
  vector<Poly> normals = clipp.subtractMerged();
  setNormalFillPolygons(normals);
  // }
}