Пример #1
0
        public static CadRect GetContainsRectScrn(DrawContext dc, VertexList list)
        {
            CadRect rect = default(CadRect);

            double minx = CadConst.MaxValue;
            double miny = CadConst.MaxValue;

            double maxx = CadConst.MinValue;
            double maxy = CadConst.MinValue;

            list.ForEach(p =>
            {
                CadVertex v = dc.WorldPointToDevPoint(p);

                minx = Math.Min(minx, v.X);
                miny = Math.Min(miny, v.Y);

                maxx = Math.Max(maxx, v.X);
                maxy = Math.Max(maxy, v.Y);
            });

            rect.p0 = default(CadVertex);
            rect.p1 = default(CadVertex);

            rect.p0.X = minx;
            rect.p0.Y = miny;
            rect.p0.Z = 0;

            rect.p1.X = maxx;
            rect.p1.Y = maxy;
            rect.p1.Z = 0;

            return(rect);
        }
Пример #2
0
        public static CadRect GetContainsRectScrn(DrawContext dc, List <CadFigure> list)
        {
            CadRect rect = default(CadRect);
            CadRect fr;

            double minx = CadConst.MaxValue;
            double miny = CadConst.MaxValue;

            double maxx = CadConst.MinValue;
            double maxy = CadConst.MinValue;

            foreach (CadFigure fig in list)
            {
                fr = fig.GetContainsRectScrn(dc);

                fr.Normalize();

                minx = Math.Min(minx, fr.p0.X);
                miny = Math.Min(miny, fr.p0.Y);
                maxx = Math.Max(maxx, fr.p1.X);
                maxy = Math.Max(maxy, fr.p1.Y);
            }

            rect.p0 = default(CadVertex);
            rect.p1 = default(CadVertex);

            rect.p0.X = minx;
            rect.p0.Y = miny;
            rect.p0.Z = 0;

            rect.p1.X = maxx;
            rect.p1.Y = maxy;
            rect.p1.Z = 0;

            return(rect);
        }
Пример #3
0
        public static CadRect GetContainsRect(VertexList list)
        {
            CadRect rect = default(CadRect);

            double minx = CadConst.MaxValue;
            double miny = CadConst.MaxValue;
            double minz = CadConst.MaxValue;

            double maxx = CadConst.MinValue;
            double maxy = CadConst.MinValue;
            double maxz = CadConst.MinValue;

            foreach (CadVertex p in list)
            {
                minx = Math.Min(minx, p.X);
                miny = Math.Min(miny, p.Y);
                minz = Math.Min(minz, p.Z);

                maxx = Math.Max(maxx, p.X);
                maxy = Math.Max(maxy, p.Y);
                maxz = Math.Max(maxz, p.Z);
            }

            rect.p0 = default(CadVertex);
            rect.p1 = default(CadVertex);

            rect.p0.X = minx;
            rect.p0.Y = miny;
            rect.p0.Z = minz;

            rect.p1.X = maxx;
            rect.p1.Y = maxy;
            rect.p1.Z = maxz;

            return(rect);
        }