C# 클래스 Project290.Physics.Common.ConvexHull.GiftWrap

파일 보기 프로젝트 열기: scastle/Solitude

공개 메소드들

메소드 설명
GetConvexHull ( Vertices vertices ) : Vertices

Find the convex hull of a point cloud using "Gift-wrap" algorithm - start with an extremal point, and walk around the outside edge by testing angles. Runs in O(N*S) time where S is number of sides of resulting polygon. Worst case: point cloud is all vertices of convex polygon: O(N^2). There may be faster algorithms to do this, should you need one - this is just the simplest. You can get O(N log N) expected time if you try, I think, and O(N) if you restrict inputs to simple polygons. Returns null if number of vertices passed is less than 3. Results should be passed through convex decomposition afterwards to ensure that each shape has few enough points to be used in Box2d. Warning: May be buggy with colinear points on hull.

메소드 상세

GetConvexHull() 공개 정적인 메소드

Find the convex hull of a point cloud using "Gift-wrap" algorithm - start with an extremal point, and walk around the outside edge by testing angles. Runs in O(N*S) time where S is number of sides of resulting polygon. Worst case: point cloud is all vertices of convex polygon: O(N^2). There may be faster algorithms to do this, should you need one - this is just the simplest. You can get O(N log N) expected time if you try, I think, and O(N) if you restrict inputs to simple polygons. Returns null if number of vertices passed is less than 3. Results should be passed through convex decomposition afterwards to ensure that each shape has few enough points to be used in Box2d. Warning: May be buggy with colinear points on hull.
public static GetConvexHull ( Vertices vertices ) : Vertices
vertices Vertices The vertices.
리턴 Vertices