public static void UpdatePolygon(PShape2D shape, PFixture2D fixture, Fix64Vec2[] verts, int count, Fix64Vec2 center, Fix64 angle) { if (!initialized) { Initialize(); } ParallelVec2List parallelVec2List = new ParallelVec2List(); parallelVec2List.count = count; parallelVec2List.points = verts; NativeParallel2D.UpdatePolygon(shape.IntPointer, fixture.IntPointer, ref parallelVec2List, center, angle); }
//polygon public static PShape2D CreatePolygon(Fix64Vec2[] verts, int count, Fix64Vec2 center, Fix64 angle) { if (!initialized) { Initialize(); } ParallelVec2List parallelVec2List = new ParallelVec2List(); parallelVec2List.count = count; parallelVec2List.points = verts; IntPtr m_NativeObject = NativeParallel2D.CreatePolygon(ref parallelVec2List, center, angle); return(new PShape2D(m_NativeObject)); }
void ConvexHull2D() { Fix64Vec2[] fixedVerts = new Fix64Vec2[vertsCount]; for (int i = 0; i < vertsCount; i++) { fixedVerts[i] = (Fix64Vec2)verts[i]; } ParallelVec2List vec2List = Parallel2D.ConvexHull2D(fixedVerts, vertsCount, limit); convexVerts = new Fix64Vec2[vec2List.count]; for (int i = 0; i < vec2List.count; i++) { convexVerts[i] = vec2List.points[i]; } convexVertsCount = vec2List.count; }
// convex hull public static ParallelVec2List ConvexHull2D(Fix64Vec2[] verts, int count, int limit) { if (!initialized) { Initialize(); } ParallelVec2List parallelVec2List = new ParallelVec2List(); parallelVec2List.count = count; parallelVec2List.points = verts; ParallelVec2List parallelVec2ListOutput = new ParallelVec2List(); parallelVec2ListOutput.count = count; parallelVec2ListOutput.points = new Fix64Vec2[count]; NativeParallel2D.ConvexHull2D(ref parallelVec2List, ref parallelVec2ListOutput, limit); return(parallelVec2ListOutput); }
internal static extern void ConvexHull2D(ref ParallelVec2List parallelVec2List, ref ParallelVec2List parallelVec2ListOut, int limit);
internal static extern void UpdatePolygon(IntPtr shapeHandle, IntPtr fixtureHandle, ref ParallelVec2List parallelVec2List, Fix64Vec2 center, Fix64 angle);
internal static extern IntPtr CreatePolygon(ref ParallelVec2List parallelVec2List, Fix64Vec2 center, Fix64 angle);