Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public double dist(nsPt q)
 {
     return(Math.Sqrt((x - q.x) * (x - q.x) + (y - q.y) * (y - q.y) + (z - q.z) * (z - q.z)));
 }
Exemplo n.º 3
0
 public nsSeg(double x0_, double y0_, double z0_, double x1_, double y1_, double z1_)
 {
     this.p = new nsPt(x0_, y0_, z0_);
     this.q = new nsPt(x1_, y1_, z1_);
 }
Exemplo n.º 4
0
 public nsSeg(nsPt p_, nsPt q_)
 {
     this.p = p_;
     this.q = q_;
 }