コード例 #1
0
ファイル: Point.cs プロジェクト: seasailor/designscript
        /// <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 Point Project(Plane contextPlane, Vector 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", "Point.Project"));
            }

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

            pt.Context        = contextPlane;
            pt.ReferencePoint = this;
            pt.Direction      = direction;
            pt.Persist();
            return(pt);
        }
コード例 #2
0
ファイル: Point.cs プロジェクト: seasailor/designscript
        /// <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 Point Project(Plane contextPlane)
        {
            if (contextPlane == null)
            {
                throw new ArgumentNullException("contextPlane");
            }

            var pt = contextPlane.Project(this);

            pt.Context        = contextPlane;
            pt.ReferencePoint = this;
            pt.Persist();
            return(pt);
        }
コード例 #3
0
ファイル: Point.cs プロジェクト: samuto/designscript
        /// <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 Point Project(Plane contextPlane, Vector 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", "Point.Project"));
            }

            var pt = contextPlane.Project(this, direction);
            pt.Context = contextPlane;
            pt.ReferencePoint = this;
            pt.Direction = direction;
            pt.Persist();
            return pt;
        }
コード例 #4
0
ファイル: Point.cs プロジェクト: samuto/designscript
        /// <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 Point Project(Plane contextPlane)
        {
            if (contextPlane == null)
            {
                throw new ArgumentNullException("contextPlane");
            }

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