SupportPolygon.h

#pragma once


namespace Core
{
    ref class Link;

    typedef array< Robotics::Point > Points;
    typedef array< Link^ > Links;


    /// 支持多角形
    public ref class SupportPolygon
    {
    // Construction --------------------------------------------------------
    public:
        SupportPolygon( System::Collections::Generic::List< Robotics::PositionVector^ >^ positionVectores );
        SupportPolygon( SupportPolygon^ other );

        ~SupportPolygon() { SupportPolygon::!SupportPolygon(); }
        !SupportPolygon();


    // Operation -----------------------------------------------------------
    public:
        double CalculateStabilityMargin( Robotics::PositionVector^ centerOfGravity );
        array< System::Drawing::PointF >^ ToPointF();

        void CreateFigure( Microsoft::DirectX::Direct3D::Device^ device );
        void Render( Microsoft::DirectX::Direct3D::Device^ device );


    // static
    public:
        static SupportPolygon^ Create( Links^ links );


    // Overload ------------------------------------------------------------
    public:
        operator Points^() { return m_vertices; }


    // Event Handler -------------------------------------------------------
    private:
        void SetFigure( System::Object^ sender, System::EventArgs^ e );


    // Attribute ===========================================================
    private:
        Points^ m_vertices;        ///< 頂点[ m ]

        Microsoft::DirectX::Direct3D::VertexBuffer^ m_figure;   ///< 図形


    // Property ------------------------------------------------------------
    public:
        /// 頂点の数
        property int CountOfVertex
        {
            int get()
            {
                return m_vertices->Length;
            }
        }

        /// 線分
        property Robotics::Segment Segment[ int ]
        {
        private:
            Robotics::Segment get( int index );
        }
    };
}