문제

I know this is very specific but since they poly2tri's Google code doesn't contain contact info I'd feel good about using, I figured I might as well ask here since someone's bound to have used the library themselves.

So here's what I want. My polygons contain coordinate information, but each point also contains stuff like color and tex coord info. Unfortunately, poly2tri only takes it's own PolygonPoint implementation that has no Tag that would let me attach extra info on it. So after the polygon gets translated to triangles, I don't know which points to attach my data to.

What would be the best approach to solving this? I was thinking of editing the code myself since it seems trivial but I don't know if poly2tri retains the same PolygonPoint instances through the algorithm or if it makes new ones (rendering my Tags useless).

도움이 되었습니까?

해결책

Just extend your PolygonPoint class and add what you need.

The points you send into the triangulation are the same you get out. Internally poly2tri does add two points outside the bound of your points just to start the triangulation these are removed when triangulation is done.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top