Esempio n. 1
0
        /// <summary>
        /// Constructors a point by projecting a point on a plane with given project direction.
        /// </summary>
        /// <param name="contextPlane">Plane of projection</param>
        /// <param name="direction">Projection direction</param>
        /// <returns>Point</returns>
        public DSPoint Project(DSPlane contextPlane, DSVector direction)
        {
            if (contextPlane == null)
            {
                throw new ArgumentNullException("contextPlane");
            }
            else if (direction == null)
            {
                throw new ArgumentNullException("direction");
            }
            else if (direction.IsZeroVector())
            {
                throw new ArgumentException(string.Format(Properties.Resources.IsZeroVector, "direction"));
            }
            else if (direction.IsPerpendicular(contextPlane.Normal))
            {
                throw new ArgumentException(string.Format(Properties.Resources.IsParallel, "contextPlane", "direction", "DSPoint.Project"));
            }

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

            pt.Context        = contextPlane;
            pt.ReferencePoint = this;
            pt.Direction      = direction;
            pt.Persist();
            return(pt);
        }
Esempio n. 2
0
        /// <summary>
        /// Constructors a point by projecting a point on a plane. It is
        /// equivalent to finding the nearest point on the plane.
        /// </summary>
        /// <param name="contextPlane">Plane of projection</param>
        /// <returns>Point</returns>
        public DSPoint Project(DSPlane contextPlane)
        {
            if (contextPlane == null)
            {
                throw new ArgumentNullException("contextPlane");
            }

            var pt = contextPlane.Project(this);

            pt.Context        = contextPlane;
            pt.ReferencePoint = this;
            pt.Persist();
            return(pt);
        }
Esempio n. 3
0
        /// <summary>
        /// Constructors a point by projecting a point on a plane with given project direction.
        /// </summary>
        /// <param name="contextPlane">Plane of projection</param>
        /// <param name="direction">Projection direction</param>
        /// <returns>Point</returns>
        public DSPoint Project(DSPlane contextPlane, DSVector direction)
        {
            if (contextPlane == null)
            {
                throw new ArgumentNullException("contextPlane");
            }
            else if (direction == null)
            {
                throw new ArgumentNullException("direction");
            }
            else if (direction.IsZeroVector())
            {
                throw new ArgumentException(string.Format(Properties.Resources.IsZeroVector, "direction"));
            }
            else if (direction.IsPerpendicular(contextPlane.Normal))
            {
                throw new ArgumentException(string.Format(Properties.Resources.IsParallel, "contextPlane", "direction", "DSPoint.Project"));
            }

            var pt = contextPlane.Project(this, direction);
            pt.Context = contextPlane;
            pt.ReferencePoint = this;
            pt.Direction = direction;
            pt.Persist();
            return pt;
        }
Esempio n. 4
0
        /// <summary>
        /// Constructors a point by projecting a point on a plane. It is 
        /// equivalent to finding the nearest point on the plane.
        /// </summary>
        /// <param name="contextPlane">Plane of projection</param>
        /// <returns>Point</returns>
        public DSPoint Project(DSPlane contextPlane)
        {
            if (contextPlane == null)
            {
                throw new ArgumentNullException("contextPlane");
            }

            var pt = contextPlane.Project(this);
            pt.Context = contextPlane;
            pt.ReferencePoint = this;
            pt.Persist();
            return pt;
        }