Bingo, Computer Graphics & Game Developer
Easy to subdivide a complex 2d shape to triangles.
Support OSX
(Xcode 6.0) Windows
(Visual Studio 2012), and Linux
(QtCreator, Ubuntu, Thanks for icq4ever).
Based on Jonathan Richard Shewchuk
‘s triangle library
ofApp.cpp
+ ofApp.h
+ main.cpp
(Thanks for icq4ever)
Simplest way to init ofxTriangular
.
// set a boundary made by ofPolyline
ofPolyline polyline
triangular.setBoundary(polyline);
If your 2d shape include some holes in it.
// set a hole made by ofPolyline
// one ofxHole connect one point inside it.
ofxHole hole;
vector<ofxHole> holes;
// only if point(x, y) was inside the hole that you want to add.
if(holeline.inside(x, y))
{
hole.set(holeline, ofPoint(x, y));
holes.push_back(hole);
}
triangular.setHoles(holes);
Subdivide complex 2d shape to triangles.
// generate the triangle collections
triangles = triangular.triangulate();
If you want to render the triangle that ofxTriangular generated.
// loop all of it if needed
for(int i=0; i<triangles.size(); i++)
{
triangles[i].draw();
}
Tesselation
was enabled, but the effect of it was not obvious.(unless you set the option tesselation
0
compared with 600
)iteration
, constraint
. etc(haven’t open the API
yet).Debug
is much easier to crash than the Release
.Only in some exreme cases (complex nested boundary) that ofxTriangular runs on Windows was easier to crash than the OSX.
int 官某某 = Bingo;
char[] 个人博客 = "http://bentleyblanks.github.io";