Exemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pts"></param>
        /// <param name="startTangent"></param>
        /// <param name="endTangent"></param>
        /// <returns></returns>
        public static BSplineCurve ByPoints(Point[] pts, Vector startTangent, Vector endTangent)
        {
            if (pts == null || startTangent == null || endTangent == null ||
                startTangent.IsZeroVector() || endTangent.IsZeroVector())
            {
                return null;
            }

            IBSplineCurveHost ent = HostFactory.Factory.BSplineByPoints(pts.ToHostArray(), startTangent, endTangent);
            var spline = new BSplineCurve(ent, true);
            spline.Points = pts;
            spline.Degree = 3;
            spline.StartTangent = startTangent;
            spline.EndTangent = endTangent;

            return spline;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pts"></param>
        /// <returns></returns>
        public static BSplineCurve ByPoints(Point[] pts)
        {
            if (pts == null)
            {
                return null;
            }

            int degree = 3;
            var ent = HostFactory.Factory.BSplineByPoints(pts.ToHostArray(), false);
            var spline = new BSplineCurve(ent, true);
            spline.Points = pts;
            spline.Degree = degree;

            return spline;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pts"></param>
        /// <param name="makePeriodic"></param>
        /// <returns></returns>
        public static BSplineCurve ByPoints(Point[] pts, bool makePeriodic)
        {
            if (pts == null)
            {
                return null;
            }

            var ent = HostFactory.Factory.BSplineByPoints(pts.ToHostArray(), makePeriodic);
            var spline = new BSplineCurve(ent, true);
            spline.Points = pts;
            spline.Degree = 3;
            spline.IsPeriodic = makePeriodic;

            return spline;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="controlVertices"></param>
        /// <param name="degree"></param>
        /// <param name="makePeriodic"></param>
        /// <returns></returns>
        public static BSplineCurve ByControlVertices(Point[] controlVertices, int degree, bool makePeriodic)
        {
            if (controlVertices == null || degree < 3)
            {
                return null;
            }
            else if (controlVertices.Length < degree + 1)
            {
                return null;
            }

            var ent = HostFactory.Factory.BSplineByControlVertices(controlVertices.ToHostArray(), degree, makePeriodic);
            var spline = new BSplineCurve(ent, true);
            spline.ControlVertices = controlVertices;
            spline.Degree = degree;

            return spline;
        }