示例#1
0
        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);
        }
示例#2
0
 public QuickHull(GeoPointsArray3 points)
 {
     mPoints = points;
     mPoints.Distinct();
     mVertexCount         = mPoints.Size();
     mTrianglePlanePoints = new List <QHullTrianglePlanePoints>();
 }
示例#3
0
 public void BuildHull()
 {
     if (mPoints.Size() < 4)
     {
         return;
     }
     Build();
     CleanTrianglePlaneList();
 }