Пример #1
0
        public void DrawBouncingBox(DrawPen pen, MinMax3D mm)
        {
            Vector3d p0 = new Vector3d(mm.Min.X, mm.Min.Y, mm.Min.Z);
            Vector3d p1 = new Vector3d(mm.Min.X, mm.Min.Y, mm.Max.Z);
            Vector3d p2 = new Vector3d(mm.Max.X, mm.Min.Y, mm.Max.Z);
            Vector3d p3 = new Vector3d(mm.Max.X, mm.Min.Y, mm.Min.Z);

            Vector3d p4 = new Vector3d(mm.Min.X, mm.Max.Y, mm.Min.Z);
            Vector3d p5 = new Vector3d(mm.Min.X, mm.Max.Y, mm.Max.Z);
            Vector3d p6 = new Vector3d(mm.Max.X, mm.Max.Y, mm.Max.Z);
            Vector3d p7 = new Vector3d(mm.Max.X, mm.Max.Y, mm.Min.Z);

            DC.Drawing.DrawLine(pen, p0, p1);
            DC.Drawing.DrawLine(pen, p1, p2);
            DC.Drawing.DrawLine(pen, p2, p3);
            DC.Drawing.DrawLine(pen, p3, p0);

            DC.Drawing.DrawLine(pen, p4, p5);
            DC.Drawing.DrawLine(pen, p5, p6);
            DC.Drawing.DrawLine(pen, p6, p7);
            DC.Drawing.DrawLine(pen, p7, p4);

            DC.Drawing.DrawLine(pen, p0, p4);
            DC.Drawing.DrawLine(pen, p1, p5);
            DC.Drawing.DrawLine(pen, p2, p6);
            DC.Drawing.DrawLine(pen, p3, p7);
        }
Пример #2
0
        public static MinMax3D GetFigureMinMaxIncludeChild(CadFigure fig)
        {
            MinMax3D mm = MinMax3D.Create();

            fig.ForEachFig(item =>
            {
                mm.Check(GetFigureMinMax(item));
            });

            return(mm);
        }
Пример #3
0
        public static MinMax3D GetFigureMinMaxIncludeChild(List <CadFigure> figList)
        {
            MinMax3D mm = MinMax3D.Create();

            foreach (CadFigure fig in figList)
            {
                MinMax3D tmm = GetFigureMinMaxIncludeChild(fig);
                mm.Check(tmm);
            }

            return(mm);
        }
Пример #4
0
        public static MinMax3D GetFigureMinMax(CadFigure fig)
        {
            MinMax3D mm = MinMax3D.Create();

            int i = 0;

            for (; i < fig.PointCount; i++)
            {
                mm.Check(fig.PointList[i].vector);
            }

            return(mm);
        }
Пример #5
0
        public static MinMax3D Create(
            )
        {
            MinMax3D mm = default;

            mm.Min.X = Double.MaxValue;
            mm.Min.Y = Double.MaxValue;
            mm.Min.Z = Double.MaxValue;

            mm.Max.X = Double.MinValue;
            mm.Max.Y = Double.MinValue;
            mm.Max.Z = Double.MinValue;

            return(mm);
        }
Пример #6
0
 public void Check(MinMax3D mm)
 {
     CheckMin(mm);
     CheckMax(mm);
 }
Пример #7
0
 public void CheckMax(MinMax3D mm)
 {
     Max.X = Math.Max(Max.X, mm.Max.X);
     Max.Y = Math.Max(Max.Y, mm.Max.Y);
 }
Пример #8
0
 public void CheckMin(MinMax3D mm)
 {
     Min.X = Math.Min(Min.X, mm.Min.X);
     Min.Y = Math.Min(Min.Y, mm.Min.Y);
 }