Example #1
0
        public void HorSplit(Curve iniPoly)
        {
            List <Point3d> iniPtLi = GetPolyPts(iniPoly);
            Point3d        a       = iniPtLi[0];
            Point3d        b       = iniPtLi[1];
            Point3d        c       = iniPtLi[2];
            Point3d        d       = iniPtLi[3];

            double  t = rnd.NextDouble() * 0.5 + 0.25;
            Point3d e = new Point3d(a.X + (d.X - a.X) * t, a.Y + (d.Y - a.Y) * t, 0);
            Point3d f = new Point3d(b.X + (c.X - b.X) * t, b.Y + (c.Y - b.Y) * t, 0);


            nsPt  nsE  = new nsPt(e.X, e.Y, e.Z);
            nsPt  nsF  = new nsPt(f.X, f.Y, f.Z);
            nsSeg nsEF = new nsSeg(nsE, nsF);

            PartitionSegLi.Add(nsEF);

            List <Point3d> up_ = new List <Point3d> {
                a, b, f, e, a
            };
            List <Point3d> dn_ = new List <Point3d> {
                e, f, c, d, e
            };

            PolylineCurve up = new PolylineCurve(up_);
            PolylineCurve dn = new PolylineCurve(dn_);

            BSPCrvs.Add(up);
            BSPCrvs.Add(dn);
        }
Example #2
0
        public void GenerateInitialCurve()
        {
            // rotate the curve and take the bounding box of rotation
            // find the partitions of the rotated bbx
            // extract the intersections of the curve x bbx

            ResultBBxPolys = new List <Curve>();
            BBxCrvs        = new List <Curve>();

            // initialize stack
            List <Point3d> iniPtLi = new List <Point3d>();

            Point3d[] ptArr = GetBBoxPoly(rot_SITE_CRV);
            iniPtLi.AddRange(ptArr);
            PolylineCurve iniBBX = new PolylineCurve(iniPtLi);

            BSPCrvs.Add(iniBBX);

            MaxRecursions          = NorGeomObjLi.Count;
            globalRecursionCounter = 0;
            runRecursions(); // run the recursions & update global vars

            for (int i = MaxRecursions; i < BSPCrvs.Count; i++)
            {
                Curve c2 = BSPCrvs[i].DuplicateCurve();
                c2.Transform(reverseXForm);
                ResultBBxPolys.Add(c2);
            }
        }
Example #3
0
        public void VerSplit(Curve iniPoly)
        {
            List <Point3d> iniPtLi = GetPolyPts(iniPoly);
            Point3d        a       = iniPtLi[0];
            Point3d        b       = iniPtLi[1];
            Point3d        c       = iniPtLi[2];
            Point3d        d       = iniPtLi[3];

            double  t = rnd.NextDouble() * 0.5 + 0.25;
            Point3d e = new Point3d(a.X + (b.X - a.X) * t, a.Y + (b.Y - a.Y) * t, 0);
            Point3d f = new Point3d(d.X + (c.X - d.X) * t, d.Y + (c.Y - d.Y) * t, 0);

            List <Point3d> le = new List <Point3d> {
                a, e, f, d, a
            };
            List <Point3d> ri = new List <Point3d> {
                e, b, c, f, e
            };

            PolylineCurve left  = new PolylineCurve(le);
            PolylineCurve right = new PolylineCurve(ri);

            BSPCrvs.Add(left);
            BSPCrvs.Add(right);
        }