vector<ofMesh> pen::createStrokes(ofPolyline myLine , ofColor mainColor){ vector<ofMesh> strokes; //if (myLine.size() > 3) // currentLine.simplify(); //currentLine = currentLine.getResampledBySpacing(10); myLine = myLine.getSmoothed(80); strokes.push_back(lineToMesh(myLine, ofColor(0,0,0,100), 5, ofVec2f(0,0))); //strokes.push_back(p.lineToMesh(myLine, ofColor(5,5,5), 12, ofVec2f(3,3) )); ofMesh mesh = lineToMesh(myLine, mainColor); strokes.push_back(extrudeMesh(mesh,mainColor)); strokes.push_back(mesh); return strokes; }
void meshGRegionExtruded::operator() (GRegion *gr) { gr->model()->setCurrentMeshEntity(gr); if(gr->geomType() == GEntity::DiscreteVolume) return; ExtrudeParams *ep = gr->meshAttributes.extrude; if(!ep || !ep->mesh.ExtrudeMesh || ep->geo.Mode != EXTRUDED_ENTITY) return; Msg::Info("Meshing volume %d (extruded)", gr->tag()); // destroy the mesh if it exists deMeshGRegion dem; dem(gr); // build an rtree with all the vertices on the boundary of gr MVertexRTree pos(CTX::instance()->geom.tolerance * CTX::instance()->lc); insertAllVertices(gr, pos); // volume is extruded from a surface GFace *from = gr->model()->getFaceByTag(std::abs(ep->geo.Source)); if(!from){ Msg::Error("Unknown source surface %d for extrusion", ep->geo.Source); return; } extrudeMesh(from, gr, pos); // carve holes if any (only do it now if the mesh is final, i.e., if // the mesh is recombined) if(ep->mesh.Holes.size() && ep->mesh.Recombine){ std::map<int, std::pair<double, std::vector<int> > >::iterator it; for(it = ep->mesh.Holes.begin(); it != ep->mesh.Holes.end(); it++) carveHole(gr, it->first, it->second.first, it->second.second); } }