本文整理汇总了C++中Polygon_2::reverse_orientation方法的典型用法代码示例。如果您正苦于以下问题:C++ Polygon_2::reverse_orientation方法的具体用法?C++ Polygon_2::reverse_orientation怎么用?C++ Polygon_2::reverse_orientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polygon_2
的用法示例。
在下文中一共展示了Polygon_2::reverse_orientation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: minkowskiSum
/*
* append gA+gB into the polygonSet
*/
void minkowskiSum( const Point& gA, const Polygon_2& gB, Polygon_set_2& polygonSet )
{
BOOST_ASSERT( gB.size() );
CGAL::Aff_transformation_2< Kernel > translate(
CGAL::TRANSLATION,
gA.toVector_2()
);
Polygon_2 sum ;
for ( Polygon_2::Vertex_const_iterator it = gB.vertices_begin();
it != gB.vertices_end(); ++it ) {
sum.push_back( translate.transform( *it ) );
}
if ( sum.is_clockwise_oriented() ) {
sum.reverse_orientation() ;
}
if ( polygonSet.is_empty() ) {
polygonSet.insert( sum );
}
else {
polygonSet.join( sum );
}
}
示例2: offsetPolygon
void OffsetWorker::offsetPolygon(Polygon_2 poly, double offset) {
typedef CGAL::Gps_circle_segment_traits_2<SFCGAL::Kernel> Gps_traits_2;
typedef Gps_traits_2::Polygon_2 Offset_polygon_2;
if(!poly.is_simple()) {
DM::Logger(DM::Warning) << "Can't perform offset polygon is not simple";
}
CGAL::Orientation orient = poly.orientation();
if (orient == CGAL::CLOCKWISE) {
poly.reverse_orientation();
}
const double err_bound = 0.00001;
std::list<Offset_polygon_2> inset_polygons;
CGAL::approximated_inset_2 (poly, offset, err_bound, std::back_inserter (inset_polygons));
foreach (Offset_polygon_2 p, inset_polygons) {
SFCGAL::Polygon po(this->approximate(p));
QString wkt = QString(po.asText(9).c_str());
module->addToSystem(wkt);
//emit resultPolygon(wkt);
}
示例3: mapload
geoData mapload(char* path,VisiLibity::Environment & mapEnv,VisiLibity::Visibility_Graph & visGraph,float clearDist )
{
std::ifstream in(path);
std::string s;
std::string s1="";
while(getline(in, s)) { // Discards newline char
s1=s1+s+"\n";
}
std::vector<char> xml_copy(s1.begin(), s1.end());
xml_copy.push_back('\0');
rapidxml::xml_document<> doc; // character type defaults to char
doc.parse<0>(&xml_copy[0]); // 0 means default parse flags
//std::cout << "Name of my first node is: " << doc.first_node()->name() << "\n";
rapidxml::xml_node<char> *n1;
n1=doc.first_node("svg");
n1=n1->first_node("g")->first_node("path");
//std::vector < VisiLibity::Point > poly_temp;
//geoData vertices_temp(10,poly_temp);
geoData vertices_temp;
int i=0;
while (n1)
{
vertices_temp.push_back(loadPath(n1->first_attribute("d")->value()));
n1=n1->next_sibling("path");
i++;
}
Polygon_2 mapEnvOB;
for (int j=0;j<vertices_temp[0].size();j++)
{
Point_2 nextVert= Point_2(vertices_temp[0][j][0],vertices_temp[0][j][1]);
mapEnvOB.push_back(nextVert);
};
Polygon_set_2 S;
mapEnvOB.reverse_orientation();
S.insert(mapEnvOB);
for (int k=1;k<vertices_temp.size();k++)
{
Polygon_2 holeCGAL;
for (int j=0;j<vertices_temp[k].size();j++)
{
holeCGAL.push_back(Point_2(vertices_temp[k][j][0],vertices_temp[k][j][1]));
};
//holeCGAL.reverse_orientation();
S.difference(holeCGAL);
holeCGAL.clear();
};
std::list<Polygon_with_holes_2> res;
std::list<Polygon_with_holes_2>::const_iterator it;
S.polygons_with_holes (std::back_inserter (res));
std::vector<VisiLibity::Polygon> envPolys;
for (it = res.begin(); it != res.end(); ++it)
{
if(CGAL::ON_BOUNDED_SIDE==CGAL::bounded_side_2(it->outer_boundary().vertices_begin(),it->outer_boundary().vertices_end(),Point_2(guest1.pos.x(),guest1.pos.y()),Kernel()))
{
envPolys.push_back(ConvertPolygonCGAL2Vis(it->outer_boundary()));
Polygon_with_holes_2::Hole_const_iterator hi;
for (hi=it->holes_begin();hi!=it->holes_end();++hi)
{
envPolys.push_back(ConvertPolygonCGAL2Vis(*hi));
};
break;
};
}
for (int i=0;i<envPolys.size();i++){
//envPolys.push_back(VisiLibity::Polygon(vertices_temp[i]));
//i=0;
//.........这里部分代码省略.........