本文整理汇总了C++中Lines::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ Lines::erase方法的具体用法?C++ Lines::erase怎么用?C++ Lines::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lines
的用法示例。
在下文中一共展示了Lines::erase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Point
void
BridgeDetector::coverage(double angle, Polygons* coverage) const
{
// Clone our expolygon and rotate it so that we work with vertical lines.
ExPolygon expolygon = this->expolygon;
expolygon.rotate(PI/2.0 - angle, Point(0,0));
/* Outset the bridge expolygon by half the amount we used for detecting anchors;
we'll use this one to generate our trapezoids and be sure that their vertices
are inside the anchors and not on their contours leading to false negatives. */
ExPolygons grown;
offset(expolygon, &grown, this->extrusion_width/2.0);
// Compute trapezoids according to a vertical orientation
Polygons trapezoids;
for (ExPolygons::const_iterator it = grown.begin(); it != grown.end(); ++it)
it->get_trapezoids2(&trapezoids, PI/2.0);
// get anchors, convert them to Polygons and rotate them too
Polygons anchors;
for (ExPolygons::const_iterator anchor = this->_anchors.begin(); anchor != this->_anchors.end(); ++anchor) {
Polygons pp = *anchor;
for (Polygons::iterator p = pp.begin(); p != pp.end(); ++p)
p->rotate(PI/2.0 - angle, Point(0,0));
anchors.insert(anchors.end(), pp.begin(), pp.end());
}
Polygons covered;
for (Polygons::const_iterator trapezoid = trapezoids.begin(); trapezoid != trapezoids.end(); ++trapezoid) {
Lines lines = trapezoid->lines();
Lines supported;
intersection(lines, anchors, &supported);
// not nice, we need a more robust non-numeric check
for (size_t i = 0; i < supported.size(); ++i) {
if (supported[i].length() < this->extrusion_width) {
supported.erase(supported.begin() + i);
i--;
}
}
if (supported.size() >= 2) covered.push_back(*trapezoid);
}
// merge trapezoids and rotate them back
Polygons _coverage;
union_(covered, &_coverage);
for (Polygons::iterator p = _coverage.begin(); p != _coverage.end(); ++p)
p->rotate(-(PI/2.0 - angle), Point(0,0));
// intersect trapezoids with actual bridge area to remove extra margins
// and append it to result
intersection(_coverage, this->expolygon, coverage);
/*
if (0) {
my @lines = map @{$_->lines}, @$trapezoids;
$_->rotate(-(PI/2 - $angle), [0,0]) for @lines;
require "Slic3r/SVG.pm";
Slic3r::SVG::output(
"coverage_" . rad2deg($angle) . ".svg",
expolygons => [$self->expolygon],
green_expolygons => $self->_anchors,
red_expolygons => $coverage,
lines => \@lines,
);
}
*/
}
示例2: run
virtual int run(int, char*[])
{
//
// Terminate cleanly on receipt of a signal
//
shutdownOnInterrupt();
//
// Create an object adapter.
//
Ice::ObjectAdapterPtr adapter =
communicator()->createObjectAdapterWithEndpoints("SimpleFilesystem", "default -h localhost -p 10000");
//
// Create the root directory (with name "/" and no parent)
//
DirectoryIPtr root = new DirectoryI(communicator(), "/", 0);
root->activate(adapter);
//
// Create a file called "README" in the root directory
//
FileIPtr file = new FileI(communicator(), "README", root);
Lines text;
text.push_back("This file system contains a collection of poetry.");
file->write(text);
file->activate(adapter);
//
// Create a directory called "Coleridge" in the root directory
//
DirectoryIPtr coleridge = new DirectoryI(communicator(), "Coleridge", root);
coleridge->activate(adapter);
//
// Create a file called "Kubla_Khan" in the Coleridge directory
//
file = new FileI(communicator(), "Kubla_Khan", coleridge);
text.erase(text.begin(), text.end());
text.push_back("In Xanadu did Kubla Khan");
text.push_back("A stately pleasure-dome decree:");
text.push_back("Where Alph, the sacred river, ran");
text.push_back("Through caverns measureless to man");
text.push_back("Down to a sunless sea.");
file->write(text);
file->activate(adapter);
//
// All objects are created, allow client requests now
//
adapter->activate();
//
// Wait until we are done
//
communicator()->waitForShutdown();
if(interrupted())
{
cerr << appName() << ": received signal, shutting down" << endl;
}
return 0;
}