Vector.h
#pragma once
namespace Robotics
{
ref class Matrix;
/// ベクトル
public ref class Vector
{
// Construction --------------------------------------------------------
public:
Vector( Vector^ other );
explicit Vector( int dimension );
Vector( const double* val, int dimension );
// Operation -----------------------------------------------------------
public:
void ZeroVector();
double Norm();
Matrix^ SkewSymmetricMatrix();
bool IsUnitVector( double precision );
bool IsZeroVector();
void RemoveErrorComponent();
virtual System::String^ ToString() override;
private:
void SecureDomain( int dimension );
bool IsRangeOfDimension( int index );
// static
public:
static double InnerProduct( Vector^ left, Vector^ right );
static Vector^ CrossProduct( Vector^ left, Vector^ right );
static Vector^ Combine( Vector^ left, Vector^ right );
// Overload ------------------------------------------------------------
public:
Vector^ operator-();
Vector^ operator*=( double val );
Vector^ operator/=( double val );
Vector^ operator+=( Vector^ obj );
Vector^ operator-=( Vector^ obj );
virtual bool Equals( Vector^ obj );
virtual bool Equals( Vector^ obj, double precision );
static bool operator==( Vector^ left, Vector^ right );
static bool operator!=( Vector^ left, Vector^ right );
static Vector^ operator+( Vector^ left, Vector^ right );
static Vector^ operator-( Vector^ left, Vector^ right );
static Vector^ operator*( double scalar, Vector^ obj );
static Vector^ operator*( Vector^ obj, double scalar );
static Vector^ operator/( Vector^ obj, double scalar );
/// @note
/// インスタンスとハンドルを混同する恐れがあるため、
/// 代入演算は多重定義していない。
// Attribute ===========================================================
private:
array< double >^ m_components; ///< 成分
// static
literal double Tolerance = 1.0E-8; ///< 許容誤差
// Property ------------------------------------------------------------
public:
/// Indexer
property double default[ int ]
{
double get( int index );
void set( int index, double value );
}
/// 次元
[ System::ComponentModel::Browsable( false ) ] // 参照不可
property int Dimension
{
int get()
{
return m_components->Length;
}
void set( int value );
}
};
}
// [ Reference ]「数値計算以前」Yamada.K ( http://www.asahi-net.or.jp/~uc3k-ymd/index.html )