コード例 #1
0
        /// <summary>
        /// Returns the point midway between two points.
        /// </summary>
        /// <param name="a">The first point.</param>
        /// <param name="b">The second point.</param>
        /// <returns>The point (<paramref name="a"/> + <paramref name="b"/>)/2.</returns>
        public static Point MidPoint(PointSet a, PointSet b)
        {
            if (!a.isRegular || !b.isRegular)
            {
                throw (new PointNotRegularException());
            }

            return(((a.ToVector() + b.ToVector()) / 2).ToPoint());
        }
コード例 #2
0
ファイル: PointSet.cs プロジェクト: akira-cn/Traingulate-lib
        /// <summary>
        /// Returns the point midway between two points.
        /// </summary>
        /// <param name="a">The first point.</param>
        /// <param name="b">The second point.</param>
        /// <returns>The point (<paramref name="a"/> + <paramref name="b"/>)/2.</returns>
        public static Point MidPoint(PointSet a, PointSet b)
        {
            if (!a.isRegular || !b.isRegular)
            {
                throw (new PointNotRegularException());
            }

            return ((a.ToVector() + b.ToVector()) / 2).ToPoint();
        }
コード例 #3
0
 /// <summary>
 /// Adds a point and a vector to produce a new point.
 /// </summary>
 /// <param name="a">A point.</param>
 /// <param name="b">A vector.</param>
 /// <returns>The point <paramref name="a"/> + <paramref name="b"/>.</returns>
 public static Point Add(PointSet a, Vector b)
 {
     return(Vector.Add(a.ToVector(), b).ToPoint());
 }
コード例 #4
0
ファイル: PointSet.cs プロジェクト: akira-cn/Traingulate-lib
 /// <summary>
 /// Adds a point and a vector to produce a new point.
 /// </summary>
 /// <param name="a">A point.</param>
 /// <param name="b">A vector.</param>
 /// <returns>The point <paramref name="a"/> + <paramref name="b"/>.</returns>
 public static Point Add(PointSet a, Vector b)
 {
     return Vector.Add(a.ToVector(), b).ToPoint();
 }