示例#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 by projecting a point on a curve with given project direction.
        /// </summary>
        /// <param name="curve">the curve on which the projection is to be made.</param>
        /// <param name="direction">the direction vector of the projection</param>
        /// <returns></returns>
        public DSPoint Project(DSCurve curve, DSVector direction)
        {
            if (curve == null)
            {
                throw new ArgumentNullException("curve");
            }
            else if (direction == null)
            {
                throw new ArgumentNullException("direction");
            }
            else if (direction.IsZeroVector())
            {
                throw new ArgumentException(string.Format(Properties.Resources.IsZeroVector, "direction"));
            }

            var pt = curve.Project(this, direction);

            pt.Context        = curve;
            pt.ReferencePoint = this;
            pt.Direction      = direction;
            pt.Persist();
            return(pt);
        }