Exemple #1
0
        //* ────________________________________*
        //* methods ───────────────────────────────-*

        //* -----------------------------------------------------------------------*
        /// <summary>矩形の対応する頂点座標を取得します。</summary>
        ///
        /// <param name="index">斜め方向情報のための列挙体。</param>
        /// <param name="rect">矩形。</param>
        /// <returns>矩形の頂点座標。</returns>
        public static Point getVertex(this ESkewDirection index, Rectangle rect)
        {
            Point result = Point.Zero;

            switch (index)
            {
            case ESkewDirection.leftTop:
                result = new Point(rect.Left, rect.Top);
                break;

            case ESkewDirection.leftBottom:
                result = new Point(rect.Left, rect.Bottom);
                break;

            case ESkewDirection.rightTop:
                result = new Point(rect.Right, rect.Top);
                break;

            case ESkewDirection.rightBottom:
                result = new Point(rect.Right, rect.Bottom);
                break;
            }
            return(result);
        }
Exemple #2
0
        //* -----------------------------------------------------------------------*
        /// <summary>矩形の対応する頂点座標を取得します。</summary>
        ///
        /// <param name="index">斜め方向情報のための列挙体。</param>
        /// <param name="rect">矩形。</param>
        /// <returns>矩形の頂点座標。</returns>
        public static Vector2 getVertexVector(this ESkewDirection index, Rectangle rect)
        {
            Point result = index.getVertex(rect);

            return(new Vector2(result.X, result.Y));
        }