RotationMatrix.h

#pragma once


#include "Matrix.h" // < BaseClass >
#include "Angle.h"


namespace Robotics
{
    ref class AxisVector;


    /// 回転行列
    public ref class RotationMatrix : public Matrix
    {
    // Construction --------------------------------------------------------
    public:
        RotationMatrix();
        RotationMatrix( double roll, double pitch, double yaw );

        explicit RotationMatrix( Matrix^ matrix );
        explicit RotationMatrix( System::Xml::XmlElement^ element );


    // Operation -----------------------------------------------------------
    public:
        Matrix^ LogMatrix();
        Vector^ AngularVelocityVector();

        Angle GetRoll( Angle standard );
        Angle GetPitch( Angle standard );
        Angle GetYaw( Angle standard );

        void Horizontal();

        bool IsHorizontal( double precision );
        bool IsUnitMatrix() { return IsUnitMatrix( Precision ); }

        virtual System::String^ ToString() override;
        System::String^ ToStringByRollPitchYaw();
        System::Xml::XmlElement^ ToXml( System::Xml::XmlDocument^ document );

    private:
        bool IsOrthogonalMatrix() { return IsOrthogonalMatrix( Precision ); }
        double Atan2( double y, double x );


    // static
    public:
        static RotationMatrix^ MatrixExponential( Vector^ axisVector, Angle angle );

    private:
        static bool IsCorrectSize( Matrix^ obj );


    // Overload ------------------------------------------------------------
    public:
        virtual bool Equals( RotationMatrix^ obj, Angle precision );

        static RotationMatrix^ operator*( RotationMatrix^ left, RotationMatrix^ right );
        static RotationMatrix^ operator*( RotationMatrix^ rotationMatrix, Matrix^ matrix );
        static RotationMatrix^ operator*( Matrix^ matrix, RotationMatrix^ rotationMatrix );


    // Attribute ===========================================================
    private:

    // static
        literal int DefaultRow = 3;           ///< 既定の行数
        literal int DefaultColumn = 3;        ///< 既定の列数

        literal double Precision = 1.0e-7;    ///< 計算精度


    // Property ------------------------------------------------------------
    public:
        /// ロール角[ rad ]
        property Angle Roll
        {
            Angle get();
        }

        /// ピッチ角[ rad ]
        property Angle Pitch
        {
            Angle get();
        }

        /// ヨー角[ rad ]
        property Angle Yaw
        {
            Angle get();
        }


        /// X方向の軸ベクトル
        property AxisVector^ X
        {
            AxisVector^ get();
        }

        /// Y方向の軸ベクトル
        property AxisVector^ Y
        {
            AxisVector^ get();
        }

        /// Z方向の軸ベクトル
        property AxisVector^ Z
        {
            AxisVector^ get();
        }
    };
}