Skip to content

Single header file library for performing polygon decomposing using the Bayazit algorithm.

License

Notifications You must be signed in to change notification settings

Crackshell/bayazit.h

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Bayazit.h

This is a polygon decomposer using the Bayazit algorithm. It is ported from the Farseer Physics C# code base into a single-header file library.

Exmaple usage:

Bayazit::Polygon poly;
poly.push_back(Bayazit::Point(20, -30));
poly.push_back(Bayazit::Point(10, -10));
poly.push_back(Bayazit::Point(30, -20));
poly.push_back(Bayazit::Point(30, 20));
poly.push_back(Bayazit::Point(10, 10));
poly.push_back(Bayazit::Point(20, 30));
poly.push_back(Bayazit::Point(-20, 30));
poly.push_back(Bayazit::Point(-10, 10));
poly.push_back(Bayazit::Point(-30, 20));
poly.push_back(Bayazit::Point(-30, -20));
poly.push_back(Bayazit::Point(-10, -10));
poly.push_back(Bayazit::Point(-20, -30));

Bayazit::Decomposer dec;
auto polys = dec.Decompose(poly);

for (auto p : polys)
{
	printf("poly: (%d points)\n", p.size());
	for (auto v : p)
		printf("  %f %f\n", v.x, v.y);
}

About

Single header file library for performing polygon decomposing using the Bayazit algorithm.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages