// Token: 0x060000E4 RID: 228 RVA: 0x0000A503 File Offset: 0x00008703
 internal PointClouds(List <int> xc, List <int> yc, List <int> zc, PointCloudsRoot root)
 {
     _xCollection = xc;
     _yCollection = yc;
     _zCollection = zc;
     Root         = root;
 }
        public static PointCloudsRoot Create(List <Point3d> points)
        {
            double num  = double.MaxValue;
            double num2 = double.MaxValue;
            double num3 = double.MaxValue;
            double num4 = double.MinValue;
            double num5 = double.MinValue;
            double num6 = double.MinValue;

            foreach (Point3d pt in points)
            {
                num  = Math.Min(num, pt.X);
                num4 = Math.Max(num4, pt.X);
                num2 = Math.Min(num2, pt.Y);
                num5 = Math.Max(num5, pt.Y);
                num3 = Math.Min(num3, pt.Z);
                num6 = Math.Max(num6, pt.Z);
            }
            PointCloudsRoot pointCloudsRoot = new PointCloudsRoot((int)num, (int)num2, (int)num3, (int)num4, (int)num5, (int)num6);

            foreach (Point3d point in points)
            {
                pointCloudsRoot.AddPoint(point);
            }
            pointCloudsRoot.FinalizeInput();
            return(pointCloudsRoot);
        }
        // Token: 0x0600011A RID: 282 RVA: 0x0000C320 File Offset: 0x0000A520
        public static double CalMinDistance(List <Point3d> points1, List <Point3d> points2)
        {
            double num  = double.MaxValue;
            double num2 = double.MaxValue;
            double num3 = double.MaxValue;
            double num4 = double.MinValue;
            double num5 = double.MinValue;
            double num6 = double.MinValue;

            foreach (Point3d Vector3d in points1)
            {
                num  = Math.Min(num, Vector3d.X);
                num4 = Math.Max(num4, Vector3d.X);
                num2 = Math.Min(num2, Vector3d.Y);
                num5 = Math.Max(num5, Vector3d.Y);
                num3 = Math.Min(num3, Vector3d.Z);
                num6 = Math.Max(num6, Vector3d.Z);
            }
            PointCloudsRoot pointCloudsRoot = new PointCloudsRoot((int)num, (int)num2, (int)num3, (int)num4, (int)num5, (int)num6);

            foreach (Point3d point in points1)
            {
                pointCloudsRoot.AddPoint(point);
            }
            pointCloudsRoot.FinalizeInput();
            foreach (Point3d Vector3d2 in points2)
            {
                num  = Math.Min(num, Vector3d2.X);
                num4 = Math.Max(num4, Vector3d2.X);
                num2 = Math.Min(num2, Vector3d2.Y);
                num5 = Math.Max(num5, Vector3d2.Y);
                num3 = Math.Min(num3, Vector3d2.Z);
                num6 = Math.Max(num6, Vector3d2.Z);
            }
            PointCloudsRoot pointCloudsRoot2 = new PointCloudsRoot((int)num, (int)num2, (int)num3, (int)num4, (int)num5, (int)num6);

            foreach (Point3d point2 in points2)
            {
                pointCloudsRoot2.AddPoint(point2);
            }
            pointCloudsRoot2.FinalizeInput();
            PointClouds   pointClouds  = pointCloudsRoot.GetPointClouds();
            PointClouds   pointClouds2 = pointCloudsRoot2.GetPointClouds();
            BoundingBox3D box          = pointClouds.GetBox();
            BoundingBox3D box2         = pointClouds2.GetBox();

            points1 = pointClouds.GetPoints();
            points2 = pointClouds2.GetPoints();
            int    count  = points1.Count;
            int    count2 = points2.Count;
            double result;

            if (count == 0 || count2 == 0)
            {
                result = -1.0;
            }
            else
            {
                BoxPositionType boxPositionType  = box.CalXType(box2);
                BoxPositionType boxPositionType2 = box.CalYType(box2);
                BoxPositionType boxPositionType3 = box.CalZType(box2);
                while (count > 100 || count2 > 100)
                {
                    if (boxPositionType == BoxPositionType.Intersect && boxPositionType2 == BoxPositionType.Intersect && boxPositionType3 == BoxPositionType.Intersect)
                    {
                        return(0.0);
                    }
                    if (boxPositionType > BoxPositionType.Intersect)
                    {
                        PointClouds pointClouds3;
                        PointClouds pointClouds4;
                        pointClouds.DivideXByCount(out pointClouds3, out pointClouds4);
                        PointClouds pointClouds5;
                        PointClouds pointClouds6;
                        pointClouds2.DivideXByCount(out pointClouds5, out pointClouds6);
                        if (boxPositionType == BoxPositionType.AB)
                        {
                            pointClouds  = ((pointClouds4 == null) ? pointClouds3 : pointClouds4);
                            pointClouds2 = ((pointClouds5 == null) ? pointClouds6 : pointClouds5);
                        }
                        else
                        {
                            if (boxPositionType == BoxPositionType.BA)
                            {
                                pointClouds  = ((pointClouds3 == null) ? pointClouds4 : pointClouds3);
                                pointClouds2 = ((pointClouds6 == null) ? pointClouds5 : pointClouds6);
                            }
                        }
                    }
                    else
                    {
                        if (boxPositionType2 > BoxPositionType.Intersect)
                        {
                            PointClouds pointClouds3;
                            PointClouds pointClouds4;
                            pointClouds.DivideYByCount(out pointClouds3, out pointClouds4);
                            PointClouds pointClouds5;
                            PointClouds pointClouds6;
                            pointClouds2.DivideYByCount(out pointClouds5, out pointClouds6);
                            if (boxPositionType2 == BoxPositionType.AB)
                            {
                                pointClouds  = ((pointClouds4 == null) ? pointClouds3 : pointClouds4);
                                pointClouds2 = ((pointClouds5 == null) ? pointClouds6 : pointClouds5);
                            }
                            else
                            {
                                if (boxPositionType2 == BoxPositionType.BA)
                                {
                                    pointClouds  = ((pointClouds3 == null) ? pointClouds4 : pointClouds3);
                                    pointClouds2 = ((pointClouds6 == null) ? pointClouds5 : pointClouds6);
                                }
                            }
                        }
                        else
                        {
                            if (boxPositionType3 > BoxPositionType.Intersect)
                            {
                                PointClouds pointClouds3;
                                PointClouds pointClouds4;
                                pointClouds.DivideZByCount(out pointClouds3, out pointClouds4);
                                PointClouds pointClouds5;
                                PointClouds pointClouds6;
                                pointClouds2.DivideZByCount(out pointClouds5, out pointClouds6);
                                if (boxPositionType3 == BoxPositionType.AB)
                                {
                                    pointClouds  = ((pointClouds4 == null) ? pointClouds3 : pointClouds4);
                                    pointClouds2 = ((pointClouds5 == null) ? pointClouds6 : pointClouds5);
                                }
                                else
                                {
                                    if (boxPositionType3 == BoxPositionType.BA)
                                    {
                                        pointClouds  = ((pointClouds3 == null) ? pointClouds4 : pointClouds3);
                                        pointClouds2 = ((pointClouds6 == null) ? pointClouds5 : pointClouds6);
                                    }
                                }
                            }
                        }
                    }
                    box              = pointClouds.GetBox();
                    box2             = pointClouds2.GetBox();
                    points1          = pointClouds.GetPoints();
                    points2          = pointClouds2.GetPoints();
                    count            = points1.Count;
                    count2           = points2.Count;
                    boxPositionType  = box.CalXType(box2);
                    boxPositionType2 = box.CalYType(box2);
                    boxPositionType3 = box.CalZType(box2);
                }

                var measure = Globals.WorkPart.MeasureManager.MeasureDistance(points1, points2);
                result = measure.Distance;
            }
            return(result);
        }