当前位置: 首页>>代码示例>>C++>>正文


C++ Polygon::end方法代码示例

本文整理汇总了C++中clipperlib::Polygon::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Polygon::end方法的具体用法?C++ Polygon::end怎么用?C++ Polygon::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在clipperlib::Polygon的用法示例。


在下文中一共展示了Polygon::end方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
ClipperPolygon_to_Slic3rPolygon(const ClipperLib::Polygon &input, Slic3r::Polygon &output)
{
    output.points.clear();
    for (ClipperLib::Polygon::const_iterator pit = input.begin(); pit != input.end(); ++pit) {
        output.points.push_back(Slic3r::Point( (*pit).X, (*pit).Y ));
    }
}
开发者ID:BabayDeLaKrus,项目名称:Slic3r,代码行数:8,代码来源:ClipperUtils.cpp

示例2: polygon_to_ofPolyline

//--------------------------------------------------------------
ofPolyline ofxClipper::polygon_to_ofPolyline(ClipperLib::Polygon& polygon) {
    vector<ClipperLib::IntPoint>::iterator iter;
    ofPolyline polyline;
    for(iter = polygon.begin(); iter != polygon.end(); iter++) {
        ofPoint pnt((*iter).X / double(clipperGlobalScale),  // bring back to our coords
                    (*iter).Y / double(clipperGlobalScale)); // bring back to our coords
        polyline.addVertex(pnt);
    }
    polyline.close(); // close it
    return polyline;
}
开发者ID:julapy,项目名称:ofxClipper,代码行数:12,代码来源:ofxClipper.cpp

示例3: main

int main(int argc, char* argv[]) {
	if (argc != 3) {
		cout<<"Usage: offset.exe <input.poly> <output.poly>\n\n  Input and output files should be different.\n  Only one ring poly files are accepted now without inner rings.\n  Default offset is 0.001 degree\n";
		return 0;

	}
	ifstream f(argv[1], ifstream::in);
	ofstream outfile(argv[2], ofstream::out);
	outfile.precision(9);
	string s;
	for (int i=0;i<3;i++) {
		getline(f, s);
		outfile<<s<<"\n";
	}
	ClipperLib::Polygons polygons;
	ClipperLib::Polygon polygon;
	while(!f.eof()) {
		f>>s;
		if (s == "END") {
			break;
		}
		double c1 = ::atof(s.c_str());
		f>>s;
		double c2 = ::atof(s.c_str());
		ClipperLib::IntPoint point(c1 * MUL, c2 * MUL);
		polygon.push_back(point);
	}
	polygons.push_back(polygon);
	double distance = 0.001 * MUL;

	ClipperLib::Polygons res_polygons;
	ClipperLib::OffsetPolygons (polygons, res_polygons, distance, ClipperLib::jtMiter);

	if (res_polygons.size() < 1) { cerr<<"Bad output of OffsetPolygons!\n";return 1;}
	ClipperLib::Polygon result = res_polygons.front();

	for (ClipperLib::Polygon::iterator it = result.begin(); it != result.end(); ++it) {
		ClipperLib::IntPoint point = *it;
		outfile << "   " << (point.X/MUL) << "   " << (point.Y/MUL) << " \n";
	}

	outfile<<s;
	while (!f.eof()) {
		getline(f, s);
		outfile<<s<<"\n";
	}

	return 0;
}
开发者ID:geosphere,项目名称:ua-convert,代码行数:49,代码来源:offset.cpp


注:本文中的clipperlib::Polygon::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。