Point.h

#pragma once


/// @note
/// System::Drawing::Point 構造体は int型
/// System::Drawing::PointF 構造体は float型
///
/// ここでは double型を必要とするため、
/// 独自に構造体を定義している。


namespace Robotics
{
    /// 位置
    public value class Point
    {
    // Construction --------------------------------------------------------
    public:
        Point( double X, double Y );


    // Operation -----------------------------------------------------------
    public:
        bool IsInOrigin();
        System::Drawing::PointF ToPointF();


    // static
    public:
        static double CalculateDistance( Point% left, Point% right );
        static void Swap( Point% left, Point% right );


    // Overload ------------------------------------------------------------
    public:
        Point operator-();

        Point operator+=( Point% obj );
        Point operator-=( Point% obj );
        Point operator*=( double val );
        Point operator/=( double val );

        static bool operator==( Point% left, Point% right );
        static bool operator!=( Point% left, Point% right );

        static Point operator+( Point% left, Point% right );
        static Point operator-( Point% left, Point% right );

        static Point operator*( double val, Point% obj );
        static Point operator*( Point% obj, double val );
        static Point operator/( Point% obj, double val );


    // Attribute ===========================================================
    private:
        double m_x;     ///< X
        double m_y;     ///< Y


    // Property ------------------------------------------------------------
    public:
        /// X
        property double X
        {
            double get()
            {
                return m_x;
            }
            void set( double value )
            {
                m_x = value;
            }
        }

        /// Y
        property double Y
        {
            double get()
            {
                return m_y;
            }
            void set( double value )
            {
                m_y = value;
            }
        }
    };
}