Ejemplo n.º 1
0
        private static IBSplineSurfaceEntity ByPointsCore(ref DSPoint[][] points, int uDegree, int vDegree)
        {
            if (uDegree < 2)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.LessThan, "uDegree", "two"), "uDegree");
            }
            if (uDegree > 10)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.GreaterThan, "uDegree", "ten"), "uDegree");
            }
            if (vDegree < 2)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.LessThan, "vDegree", "two"), "vDegree");
            }
            if (vDegree > 10)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.GreaterThan, "vDegree", "ten"), "vDegree");
            }

            IPointEntity[][] pts = points.ToPointEntityArray(true); //must be rectangular array.
            if (null == pts)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.InvalidArguments, "points"), "points");
            }

            // making sure if # of controlVertices > degree by atleast 1
            int udiff = pts.Length - uDegree;

            if (udiff < 1)
            {
                uDegree += udiff - 1;
            }

            int vdiff = pts[0].Length - vDegree;

            if (vdiff < 1)
            {
                vDegree += vdiff - 1;
            }

            if (pts.Length < 2)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.LessThan, "Number of points in U direction", "two"), "points");
            }
            if (pts[0].Length < 2)
            {
                throw new System.ArgumentException(string.Format(Properties.Resources.LessThan, "Number of points in V direction", "two"), "points");
            }

            points = pts.ToPointArray();
            IBSplineSurfaceEntity entity = HostFactory.Factory.BSplineSurfaceByPoints(pts, uDegree, vDegree);

            if (entity == null)
            {
                throw new System.Exception(string.Format(Properties.Resources.OperationFailed, "DSBSplineSurface.ByPoints"));
            }
            return(entity);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tol"></param>
        /// <returns></returns>
        private DSBSplineSurface ApproxBSplineSurface(double tol)
        {
            IBSplineSurfaceEntity surface = SurfaceEntity.ApproxBSpline(tol);

            return(new DSBSplineSurface(surface, true));
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private DSBSplineSurface ApproxBSplineSurface()
        {
            IBSplineSurfaceEntity surface = SurfaceEntity.ApproxBSpline(-1.0);

            return(new DSBSplineSurface(surface, true));
        }
Ejemplo n.º 4
0
 internal static BSplineSurface ToBSurf(this IBSplineSurfaceEntity host, bool persist, Geometry context)
 {
     return(host.ToGeometry <BSplineSurface, IBSplineSurfaceEntity>(persist, context));
 }
Ejemplo n.º 5
0
 internal DSBSplineSurface(IBSplineSurfaceEntity host, bool persist = false)
     : base(host, persist)
 {
     InitializeGuaranteedProperties();
 }
Ejemplo n.º 6
0
 internal DSBSplineSurface(IBSplineSurfaceEntity host, bool persist = false)
     : base(host, persist)
 {
     InitializeGuaranteedProperties();
 }