Example #1
0
        // Token: 0x060000EA RID: 234 RVA: 0x0000AE60 File Offset: 0x00009060
        public void DivideZByDistance(out PointClouds min, out PointClouds max)
        {
            min = null;
            max = null;
            int num  = (_zCollection.Last <int>() - _zCollection.First <int>()) / 2;
            int num2 = 0;

            foreach (int num3 in _zCollection)
            {
                if (num > num3)
                {
                    num2++;
                }
            }

            if (num2 == 0)
            {
                max = this;
            }
            else
            {
                List <int> range  = _zCollection.GetRange(0, num2 + 1);
                List <int> range2 = _yCollection.GetRange(0, _yCollection.Count);
                List <int> range3 = _xCollection.GetRange(0, _xCollection.Count);
                if (num2 == _zCollection.Count - 1)
                {
                    min = this;
                }
                else
                {
                    List <int> range4 = _zCollection.GetRange(num2 + 1, _zCollection.Count - num2 - 1);
                    List <int> range5 = _yCollection.GetRange(0, _yCollection.Count);
                    List <int> range6 = _xCollection.GetRange(0, _xCollection.Count);
                    foreach (int item in range4)
                    {
                        range2.Remove(item);
                        range3.Remove(item);
                    }
                    foreach (int item2 in range)
                    {
                        range5.Remove(item2);
                        range6.Remove(item2);
                    }
                    min = new PointClouds(range3, range2, range, Root);
                    max = new PointClouds(range6, range5, range4, Root);
                }
            }
        }
Example #2
0
        // Token: 0x060000E6 RID: 230 RVA: 0x0000A6E8 File Offset: 0x000088E8
        public void DivideYByCount(out PointClouds min, out PointClouds max)
        {
            min = null;
            max = null;
            int num = _yCollection.Count / 2;

            if (num == 0)
            {
                max = this;
            }
            else
            {
                List <int> range  = _yCollection.GetRange(0, num + 1);
                List <int> range2 = _xCollection.GetRange(0, _xCollection.Count);
                List <int> range3 = _zCollection.GetRange(0, _zCollection.Count);
                if (num == _yCollection.Count - 1)
                {
                    min = this;
                }
                else
                {
                    List <int> range4 = _yCollection.GetRange(num + 1, _yCollection.Count - num - 1);
                    List <int> range5 = _xCollection.GetRange(0, _xCollection.Count);
                    List <int> range6 = _zCollection.GetRange(0, _zCollection.Count);
                    foreach (int item in range4)
                    {
                        range2.Remove(item);
                        range3.Remove(item);
                    }
                    foreach (int item2 in range)
                    {
                        range5.Remove(item2);
                        range6.Remove(item2);
                    }
                    min = new PointClouds(range2, range, range3, Root);
                    max = new PointClouds(range5, range4, range6, Root);
                }
            }
        }
        // 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);
        }