Cgal Unity May 2026

: No native plugin complexity, CGAL runs fully isolated. Cons : Slower, serialization overhead.

extern "C" __declspec(dllexport) float* ComputeConvexHull(float* points, int count, int* outCount) std::vector<Point_2> pts, result; for (int i = 0; i < count; i++) pts.push_back(Point_2(points[2 i], points[2 i+1])); CGAL::convex_hull_2(pts.begin(), pts.end(), std::back_inserter(result)); outCount = result.size(); float out = new float[2 * result.size()]; for (size_t i = 0; i < result.size(); i++) out[2 i] = CGAL::to_double(result[i].x()); out[2 i+1] = CGAL::to_double(result[i].y()); cgal unity

void TestHull() float[] pts = 0,0, 1,0, 1,1, 0,1, 0.5f,0.5f ; int outCount = 0; IntPtr ptr = ComputeConvexHull(pts, 5, ref outCount); float[] result = new float[outCount * 2]; Marshal.Copy(ptr, result, 0, outCount * 2); // Convert to Vector2[] and use in Unity // Remember to free native memory (expose a free function) : No native plugin complexity, CGAL runs fully isolated