public static bool IsOnSamePlane(GeoPointsArray3 points, ref GeoPlane plane) { if (points.Size() < 4) { return(true); } int count = points.Size(); int i = 2; Vector3 p = points[0]; for (; i < count; ++i) { p = points[i]; if (!GeoLineUtils.IsPointInLine3(points[0], points[1], ref p)) { break; } } if (i == count) { return(true); } plane = GeoPlaneUtils.CreateFromTriangle(points[0], points[1], p); i = 2; int c = 2; for (; i < count; ++i) { if (GeoPlaneUtils.IsPointOnPlane(plane.mNormal, plane.mD, points[i])) { c++; } } return(c == count); }
public QuickHull(GeoPointsArray3 points) { mPoints = points; mPoints.Distinct(); mVertexCount = mPoints.Size(); mTrianglePlanePoints = new List <QHullTrianglePlanePoints>(); }
public void BuildHull() { if (mPoints.Size() < 4) { return; } Build(); CleanTrianglePlaneList(); }