Exemplo n.º 1
0
        /// <summary>
        /// The points index example is as following.
        /// The reason for this setting is to look at the coordinate like points[x][y].
        /// As a result, The number of U count is 3 and that of V count is 5.
        ///
        ///  3*---7*--11*
        ///    |      |    |
        ///  2*---6*--10*
        ///    |      |    |
        ///  1*---5*---9*
        ///    |      |    |
        ///  0*---4*---8*
        ///
        /// </summary>
        /// <param name="_pointsGrid"></param>
        public NURBSSurface(IEnumerable <IEnumerable <IEnumerable <double> > > _pointsGrid, KnotSet uKnotVector, KnotSet vKnotVector, int uDegree, int vDegree, IEnumerable <IEnumerable <double> > _weights)
        {
            List <List <Point3d> > ptss = new List <List <Point3d> >();
            List <List <double> >  wss  = new List <List <double> >();

            for (int i = 0; i < _pointsGrid.Count(); i++)
            {
                wss.Add(new List <double>());
                var ws = _weights.ElementAt(i);

                ptss.Add(new List <Point3d>());
                var pts = _pointsGrid.ElementAt(i);

                for (int j = 0; j < pts.Count(); j++)
                {
                    double w = ws.ElementAt(j);
                    wss.Last().Add(w);

                    IEnumerable <double> pt = pts.ElementAt(j);
                    Point3d target          = new Point3d(pt);
                    ptss.Last().Add(target);
                }
            }
            this.pointsGrid = ptss.Select(n => n.ToArray()).ToArray();
            this.weights    = wss.Select(n => n.ToArray()).ToArray();

            this.uKnotVector = (KnotSet)uKnotVector.Clone();
            this.vKnotVector = (KnotSet)vKnotVector.Clone();
            this.uDegree     = uDegree;
            this.vDegree     = vDegree;
        }
Exemplo n.º 2
0
        public BSplineCurve(IEnumerable <IEnumerable <double> > pts, KnotSet knots, int degree)
        {
            var pointList = new List <Point3d>();

            foreach (var pt in pts)
            {
                Point3d pt3d = new Point3d(pt.ToArray());
                pointList.Add(pt3d);
            }

            this.points     = pointList.ToArray();
            this.knotVector = (KnotSet)knots.Clone();
            this.degree     = degree;
        }
Exemplo n.º 3
0
 public BSplineBasisInfo(int i, int j, KnotSet knots)
 {
     this.I     = i;
     this.J     = j;
     this.Knots = (KnotSet)knots.Clone();
 }