示例#1
0
        /// <summary>
        /// Constructs a point by projecting a point on a curve which which closest to the curve
        /// </summary>
        /// <param name="curve">the curve on which the projection is to be made.</param>
        /// <returns></returns>
        public DSPoint Project(DSCurve curve)
        {
            if (curve == null)
            {
                throw new ArgumentNullException("curve");
            }

            var pt = curve.Project(this);

            pt.Context = curve;
            double param = curve.ParameterAtPoint(pt);

            pt.T              = param;
            pt.Distance       = curve.DistanceAtParameter(param);
            pt.ReferencePoint = this;
            pt.Persist();
            return(pt);
        }
示例#2
0
        /// <summary>
        /// Constructs a point at a given parameter on the input curve.
        /// </summary>
        /// <param name="contextCurve">Input curve</param>
        /// <param name="parameter">Parameter value.</param>
        /// <returns>Point</returns>
        public static DSPoint AtParameter(DSCurve contextCurve, double parameter)
        {
            if (contextCurve == null)
            {
                throw new ArgumentNullException("contextCurve");
            }

            var pt = contextCurve.PointAtParameter(parameter);

            if (null == pt)
            {
                return(null);
            }
            pt.Context  = contextCurve;
            pt.T        = parameter;
            pt.Distance = contextCurve.DistanceAtParameter(parameter);
            pt.Persist();
            return(pt);
        }