Example #1
0
            private List <box> cutingY(List <double> item1, List <double> item2)
            {
                List <box> output = new List <box>();
                double     t      = item1.Sum() / (item.Sum());

                if (item.Sum() == 0)
                {
                    __out.Add("box cutY error,null intput element"); return(output);
                }
                if (t <= 0 || t > 1)
                {
                    __out.Add("box cutY error"); return(output);
                }
                box box1 = new box(this.Vertice[0], new Point3d(this.Vertice[2].X, (this.Vertice[2].Y - this.Vertice[0].Y) * t + this.Vertice[0].Y, 0));

                box1.Additem(item1);
                box box2 = new box(new Point3d(this.Vertice[0].X, (this.Vertice[2].Y - this.Vertice[0].Y) * t + this.Vertice[0].Y, 0), this.Vertice[2]);

                box2.Additem(item2);
                output.Add(box1);
                output.Add(box2);
                return(output);
            }
Example #2
0
 private List<box> cutingY(List<double> item1, List<double> item2)
 {
     List<box> output = new List<box>();
     double t = item1.Sum() / (item.Sum());
     if (item.Sum() == 0) { __out.Add("box cutY error,null intput element"); return output; }
     if (t <= 0 || t > 1) { __out.Add("box cutY error"); return output; }
     box box1 = new box(this.Vertice[0], new Point3d(this.Vertice[2].X, (this.Vertice[2].Y - this.Vertice[0].Y) * t + this.Vertice[0].Y, 0));
     box1.Additem(item1);
     box box2 = new box(new Point3d(this.Vertice[0].X, (this.Vertice[2].Y - this.Vertice[0].Y) * t + this.Vertice[0].Y, 0), this.Vertice[2]);
     box2.Additem(item2);
     output.Add(box1);
     output.Add(box2);
     return output;
 }
Example #3
0
        public List<Polyline> ComputeTreeMap(List<double> x, List<double> y,int type)
        {
            for(int i = 0;i < x.Count;i++){
            x[i] = Math.Abs(x[i]) * Math.Abs(y[0]) * Math.Abs(y[1]);
              }

              List<box> b1 = new List<box>();
              List<box> b2 = new List<box>();
              List<box> temp;
              box boxtemp = new box(Math.Abs(y[0]), Math.Abs(y[1]));
              boxtemp.Additem(x);
              b1.Add(boxtemp);
              if (type == 1)
              {
              for (int k = 0; k < x.Count; k++)
              {
              bool sign = false;
              for (int i = 0; i < b1.Count; i++)
              {
                  if (b1[i].cut(out temp)) { sign = true; }
                  b2.AddRange(temp);
              }

              b1.Clear(); b1.AddRange(b2);
              b2 = new List<box>();
              if (!sign) { break; }
              }
              }
              else
              {
              for (int k = 0; k < x.Count; k++)
              {
              bool sign = false;
              for (int i = 0; i < b1.Count; i++)
              {
                  if (b1[i].cut_random(out temp)) { sign = true; }
                  b2.AddRange(temp);
              }

              b1.Clear(); b1.AddRange(b2);
              b2 = new List<box>();
              if (!sign) { break; }
              }
              }
              List<Polyline> output = new List<Polyline>();
              for(int i = 0;i < b1.Count;i++){
            output.Add(b1[i].drawPolyline());
              }
            return output;
        }
Example #4
0
        public List <Polyline> ComputeTreeMap(List <double> x, List <double> y, int type)
        {
            for (int i = 0; i < x.Count; i++)
            {
                x[i] = Math.Abs(x[i]) * Math.Abs(y[0]) * Math.Abs(y[1]);
            }

            List <box> b1 = new List <box>();
            List <box> b2 = new List <box>();
            List <box> temp;
            box        boxtemp = new box(Math.Abs(y[0]), Math.Abs(y[1]));

            boxtemp.Additem(x);
            b1.Add(boxtemp);
            if (type == 1)
            {
                for (int k = 0; k < x.Count; k++)
                {
                    bool sign = false;
                    for (int i = 0; i < b1.Count; i++)
                    {
                        if (b1[i].cut(out temp))
                        {
                            sign = true;
                        }
                        b2.AddRange(temp);
                    }

                    b1.Clear(); b1.AddRange(b2);
                    b2 = new List <box>();
                    if (!sign)
                    {
                        break;
                    }
                }
            }
            else
            {
                for (int k = 0; k < x.Count; k++)
                {
                    bool sign = false;
                    for (int i = 0; i < b1.Count; i++)
                    {
                        if (b1[i].cut_random(out temp))
                        {
                            sign = true;
                        }
                        b2.AddRange(temp);
                    }

                    b1.Clear(); b1.AddRange(b2);
                    b2 = new List <box>();
                    if (!sign)
                    {
                        break;
                    }
                }
            }
            List <Polyline> output = new List <Polyline>();

            for (int i = 0; i < b1.Count; i++)
            {
                output.Add(b1[i].drawPolyline());
            }
            return(output);
        }