MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
MGVector クラス

Vector of a general n space dimension. [詳解]

MGVector の継承関係図
MGUnit_vector

公開メンバ関数

 MGVector (int sdim=0)
 Void constructor. [詳解]
 
 MGVector (double x, double y)
 Construct 2D vector by providing each element data. [詳解]
 
 MGVector (double x, double y, double z)
 Construct 3D vector by providing each element data. [詳解]
 
 MGVector (double x, double y, double z, double w)
 Construct 4D vector by providing each element data. [詳解]
 
 MGVector (int sdim, double v)
 
 MGVector (int sdim, const double *v)
 
 MGVector (const MGPosition &)
 
 MGVector (const MGVector &dvec, const MGVector &svec)
 Construct a vector from a difference of two vectors. [詳解]
 
 MGVector (int sdim, const MGVector &vec2, int start1=0, int start2=0)
 
 MGVector (const std::vector< double > &darrays)
 Construct from std::vector<double> [詳解]
 
 MGVector (const MGVector &)
 Copy constructor. [詳解]
 
 ~MGVector ()
 
MGVectoroperator= (const MGVector &)
 Assignment. [詳解]
 
double operator() (int i) const
 Return i-th element of the vector. [詳解]
 
double operator[] (int i) const
 Return i-th element of the vector. [詳解]
 
double & operator() (int i)
 
MGVectoroperator= (const double *)
 Update vector data by array of double. [詳解]
 
MGVectoroperator+= (const MGVector &)
 
MGVector operator- () const
 
MGVectoroperator-= (const MGVector &)
 
MGVectoroperator*= (double scale)
 
MGVectoroperator*= (const MGVector &vec2)
 Update own vector by vector product output, changes to 3D vector. [詳解]
 
MGVectoroperator/= (double scale)
 
double angle (const MGVector &) const
 
double anglepai (const MGVector &v2) const
 
double angle2pai (const MGVector &v2, const MGVector &N) const
 
double cangle (const MGVector &) const
 
MGVectorclear (double init=0.0)
 Clear all the element by the value init. [詳解]
 
const double * data () const
 Return the 1st address of the array of the vector double data. [詳解]
 
double * data ()
 
MGVector interpolate (double t, const MGVector &vec2) const
 
MGVector interpolate_by_rotate (double t, const MGVector &vec2, double *ratio=0) const
 
bool is_collinear (const MGVector &v2) const
 
bool is_collinear (const MGVector &v2, const MGVector &v3) const
 
bool is_null () const
 Test if this is null. [詳解]
 
bool is_unit_vector () const
 
bool is_zero_vector () const
 Return true when the vector is a zero vector. [詳解]
 
double len () const
 
void negate ()
 Negate the vector. [詳解]
 
MGUnit_vector normalize () const
 
bool orthogonal (const MGVector &) const
 
int out_to_IGES (MGIgesOfstream &igesfile, int SubordinateEntitySwitch=0) const
 
MGVector orthogonize (const MGVector &vec2) const
 
bool parallel (const MGVector &) const
 
MGVector project (const MGVector &v2) const
 
double ref (int i) const
 Reference to i-th element. [詳解]
 
void resize (int new_sdim)
 
double sangle (const MGVector &) const
 
int sdim () const
 Get the space dimension. [詳解]
 
void set_null ()
 Set this as a null vector. [詳解]
 
void set_unit ()
 Change this to a unit vector. [詳解]
 
void store_at (int i, const MGVector &vec2, int j=0)
 
void store_at (int i, const MGVector &vec2, int j, int len)
 
void swap (int i, int j)
 
int dump_size () const
 
int dump (MGOfstream &) const
 Dump Function. [詳解]
 
int restore (MGIfstream &)
 Restore Function. [詳解]
 

限定公開メンバ関数

double & set (int i)
 When length not computed, negative value will be set. [詳解]
 

限定公開変数類

int m_sdim
 Friend Function. [詳解]
 
double * m_element
 
double m_data [3]
 
double m_length
 For vector data of space dimension less or equal to 3. [詳解]
 

フレンド

MG_DLL_DECLR friend MGVector operator+ (const MGVector &vec1, const MGVector &vec2)
 
MG_DLL_DECLR friend MGVector operator- (const MGVector &vec1, const MGVector &vec2)
 
MG_DLL_DECLR friend double operator% (const MGVector &vec1, const MGVector &vec2)
 
MG_DLL_DECLR friend MGVector operator* (const MGVector &vec1, const MGVector &vec2)
 
MG_DLL_DECLR friend MGVector operator* (const MGVector &vec1, double scale)
 
MG_DLL_DECLR friend MGVector operator* (double, const MGVector &)
 
MG_DLL_DECLR friend MGVector operator/ (const MGVector &vec1, double scale)
 
bool operator< (const MGVector &v1, const MGVector &v2)
 
bool operator<= (const MGVector &v1, const MGVector &v2)
 
bool operator> (const MGVector &v1, const MGVector &v2)
 
bool operator>= (const MGVector &v1, const MGVector &v2)
 
MG_DLL_DECLR friend bool operator== (const MGVector &v1, const MGVector &v2)
 
bool operator!= (const MGVector &v1, const MGVector &v2)
 
MG_DLL_DECLR friend std::ostream & operator<< (std::ostream &, const MGVector &)
 String stream function. [詳解]
 
MG_DLL_DECLR friend double MGDeterminant (const MGVector &v1, const MGVector &v2, const MGVector &v3)
 

詳解

Vector of a general n space dimension.

構築子と解体子

MGVector::MGVector ( int  sdim = 0)
explicit

Void constructor.

MGVector::MGVector ( double  x,
double  y 
)

Construct 2D vector by providing each element data.

MGVector::MGVector ( double  x,
double  y,
double  z 
)

Construct 3D vector by providing each element data.

MGVector::MGVector ( double  x,
double  y,
double  z,
double  w 
)

Construct 4D vector by providing each element data.

MGVector::MGVector ( int  sdim,
double  v 
)

初期値 v ですべてのエレメントを初期化してベクトルを生成する。 Vector of same value for each coordinate element.

MGVector::MGVector ( int  sdim,
const double *  v 
)

double の配列でエレメントを初期化してベクトルを生成する。 Vector from array of double v[sdim]. ***** This is the fundamental constructor.*****

MGVector::MGVector ( const MGPosition )

Construct a vector from a class MGPosition. Vector from a position.

MGVector::MGVector ( const MGVector dvec,
const MGVector svec 
)

Construct a vector from a difference of two vectors.

引数
dvecDestination point
svecSource point
MGVector::MGVector ( int  sdim,
const MGVector vec2,
int  start1 = 0,
int  start2 = 0 
)

Construct Vector by copying old Vector, changing space dimension and ordering of old coordinates. (*this)(start1+i)=vec2(start2+i).

引数
sdimSpace dimension.
vec2Original vector.
start1id of constructing vector that indicates from where to store the elements of vec2.
start2id of vec2.
MGVector::MGVector ( const std::vector< double > &  darrays)

Construct from std::vector<double>

MGVector::MGVector ( const MGVector )

Copy constructor.

Construct from std::valarray<double> MGVector(const std::valarray<double>& darrays);

MGVector::~MGVector ( )
inline

関数詳解

double MGVector::angle ( const MGVector ) const

自身のベクトルと与えられたベクトルのなす角度を Radian で返却 Compute angle in radian of two vectors. 0<= angle <pai.

double MGVector::angle2pai ( const MGVector v2,
const MGVector N 
) const

Compute the angle in radian that is measured from this to v2 around the normal N. The angle's range is 0<= angle <2*pai. Although N is assumed to be parallel to N2=(*this)*v2, N may not perpendicular to v1 and v2, in which case, the projected N to N2 is used to measure the angle. v1.angle2pai(v2,N)+v2.angle2pai(v1,N)=2*pai always holds.

double MGVector::anglepai ( const MGVector v2) const
inline

Compute angle in radian of two vectors. 0<= angle <pai.

double MGVector::cangle ( const MGVector ) const

自身のベクトルと与えられたベクトルのなす角度を cosΘ で返却する 自身か与えられたベクトルが零ベクトルの時は、cosΘは 1.0 とする Compute angle in cosine of two vectors.

MGVector& MGVector::clear ( double  init = 0.0)

Clear all the element by the value init.

const double* MGVector::data ( ) const
inline

Return the 1st address of the array of the vector double data.

double* MGVector::data ( )
inline
int MGVector::dump ( MGOfstream ) const

Dump Function.

int MGVector::dump_size ( ) const

Dump Functions. Calculate dump size

MGVector MGVector::interpolate ( double  t,
const MGVector vec2 
) const

Generate a vector by interpolating two vectors. Input scalar is a ratio and when zero, output vector is a copy of this. New vector vnew=(1-t)(*this)+t*vec2.

MGVector MGVector::interpolate_by_rotate ( double  t,
const MGVector vec2,
double *  ratio = 0 
) const

Generate a vector by interpolating two vectors by rotation. Input scalar t is a ratio and when t is zero, output vector is a copy of this and when t=1., output is vec2. New vector vnew=a(*this)+b*vec2, where a=sin(theta2)/sin(theta), b=sin(theta1)/sin(theta). Here, theta=angle of *this and vec2. theta1=t*theta, theta2=theta-theta1. theta may be zero. When ratio is not null, ratio[0]=a and ratio[1]=b will be returned.

bool MGVector::is_collinear ( const MGVector v2) const
inline

Test if this and v2 are on a single straight line. Function's return value is true if the three points are on a straight, false if not.

bool MGVector::is_collinear ( const MGVector v2,
const MGVector v3 
) const

Test if this, v2, and v3 are on a single straight line. Function's return value is true if the three points are on a straight, false if not.

bool MGVector::is_null ( ) const
inline

Test if this is null.

bool MGVector::is_unit_vector ( ) const

自身のベクトルが単位ベクトルなら TRUE を返却 Test if the vector is unit.

bool MGVector::is_zero_vector ( ) const

Return true when the vector is a zero vector.

double MGVector::len ( ) const

ベクトルの長さを返却する。 Return vector length.

void MGVector::negate ( )
inline

Negate the vector.

MGUnit_vector MGVector::normalize ( ) const

一般ベクトルを単位ベクトル化しオブジェクトを生成 Generate unit vector from the vector.

double MGVector::operator() ( int  i) const
inline

Return i-th element of the vector.

double& MGVector::operator() ( int  i)

Access to i-th Inteval. This is left hand side value operator. If only regference is needed, operator[] should be used.

MGVector& MGVector::operator*= ( double  scale)

スカラーの乗算を行い自身のベクトルとする Scalar multiplication.

MGVector& MGVector::operator*= ( const MGVector vec2)

Update own vector by vector product output, changes to 3D vector.

MGVector& MGVector::operator+= ( const MGVector )

自身のベクトルに与えられたベクトルを加算して自身のベクトルとする Addition of two vectors.

MGVector MGVector::operator- ( ) const

単項マイナス。自身のベクトルを反転し、オブジェクトを生成 Unary minus. Negate all the elements of the vector.

MGVector& MGVector::operator-= ( const MGVector )

自身のベクトルから与えられたベクトルを減算し自身のベクトルとする Subtraction of two vectors.

MGVector& MGVector::operator/= ( double  scale)

スカラー除算を行い自身のベクトルとする Scalar division.

MGVector& MGVector::operator= ( const MGVector )

Assignment.

MGVector& MGVector::operator= ( const double *  )

Update vector data by array of double.

double MGVector::operator[] ( int  i) const
inline

Return i-th element of the vector.

bool MGVector::orthogonal ( const MGVector ) const

自身のベクトルと与えられたベクトルが垂直かどうか返却 垂直のばあい TRUE Test if two vectors are orthogonal, i.e. cross at right angle.

MGVector MGVector::orthogonize ( const MGVector vec2) const

Compute the vector that is orthogonal to vec2 and is closest to this. "closest" means that the angle of the two vectors is minimum and the two vector length are equal.

int MGVector::out_to_IGES ( MGIgesOfstream igesfile,
int  SubordinateEntitySwitch = 0 
) const

PD123=Direction. Function's return value is the directory entry id created.

bool MGVector::parallel ( const MGVector ) const

自身のベクトルと与えられたベクトルが平行なら TRUE を返却 Test if two vectors are parallel.

MGVector MGVector::project ( const MGVector v2) const

自身のベクトルをベクトル(v2)に射影したベクトルを求める。 v2 が 零ベクトルのとき(*this)が返る。

double MGVector::ref ( int  i) const
inline

Reference to i-th element.

void MGVector::resize ( int  new_sdim)

Resize the vector, that is , change space dimension. When this is enlarged, the extra space will contain garbages.

int MGVector::restore ( MGIfstream )

Restore Function.

double MGVector::sangle ( const MGVector ) const

自身のベクトルと与えられたベクトルのなす角度の sin値を返却 Compute angle in sine of two vectors. sanlge>=0.

int MGVector::sdim ( ) const
inline

Get the space dimension.

double& MGVector::set ( int  i)
inlineprotected

When length not computed, negative value will be set.

To hold vector length if computed.Set data at element i. This should be used with care, since m__length will not be set. Maintenance of m_length should be done by the user, that is, m_length=-1 must set if updated.

void MGVector::set_null ( )

Set this as a null vector.

void MGVector::set_unit ( )

Change this to a unit vector.

void MGVector::store_at ( int  i,
const MGVector vec2,
int  j = 0 
)

Store vec2 data into *this. Store length is vec2.len(). Storing will be done rap-around. That is, if id i or j reached to each sdim(), the id will be changed to 0.

引数
iDisplacement of *this.
vec2Vector 2.
jDisplacement of vec2.
void MGVector::store_at ( int  i,
const MGVector vec2,
int  j,
int  len 
)

Store vec2 data into *this. Storing will be done rap-around. That is, if id i or j reached to each sdim(), the id will be changed to 0.

引数
iDisplacement of *this.
vec2Vector 2.
jDisplacement of vec2.
lenLength to store
void MGVector::swap ( int  i,
int  j 
)

swap two coordinates. swap coordinates (i) and (j).

フレンドと関連関数の詳解

MG_DLL_DECLR friend double MGDeterminant ( const MGVector v1,
const MGVector v2,
const MGVector v3 
)
friend

3つのベクトルから求められる行列の行列式の値を返却する。 Determinant of 3 by 3 matrix of 3 vectors.

bool operator!= ( const MGVector v1,
const MGVector v2 
)
friend

与えられたベクトルの成分の値を比較し、not equalのとき TRUE を返却 Test if two vectors are equal.

MG_DLL_DECLR friend double operator% ( const MGVector vec1,
const MGVector vec2 
)
friend

ベクトルの内積 Inner product of two vectors.

MG_DLL_DECLR friend MGVector operator* ( const MGVector vec1,
const MGVector vec2 
)
friend

ベクタの外積 vector product of two vectors.

MG_DLL_DECLR friend MGVector operator* ( const MGVector vec1,
double  scale 
)
friend

スカラーの乗算を行いオブジェクトを生成 Scalar multiplication.

MG_DLL_DECLR friend MGVector operator* ( double  ,
const MGVector  
)
friend

ベクトルのスカラー乗算を行いオブジェクトを生成 Scalar multiplication.

MG_DLL_DECLR friend MGVector operator+ ( const MGVector vec1,
const MGVector vec2 
)
friend

ベクトルの加算 Addition of two vectors.

MG_DLL_DECLR friend MGVector operator- ( const MGVector vec1,
const MGVector vec2 
)
friend

ベクトルの減算 Subtraction of two vectors.

MG_DLL_DECLR friend MGVector operator/ ( const MGVector vec1,
double  scale 
)
friend

スカラー除算を行いオブジェクトを生成 Scalar division.

bool operator< ( const MGVector v1,
const MGVector v2 
)
friend

Test if this vector is less than v2. Comparison depends on two vectors' length.

MG_DLL_DECLR friend std::ostream& operator<< ( std::ostream &  ,
const MGVector  
)
friend

String stream function.

bool operator<= ( const MGVector v1,
const MGVector v2 
)
friend
MG_DLL_DECLR friend bool operator== ( const MGVector v1,
const MGVector v2 
)
friend

与えられたベクトルの成分の値を比較し、同じであれば TRUE を返却 Test if two vectors are equal.

bool operator> ( const MGVector v1,
const MGVector v2 
)
friend
bool operator>= ( const MGVector v1,
const MGVector v2 
)
friend

メンバ詳解

double MGVector::m_data[3]
protected
double* MGVector::m_element
protected
double MGVector::m_length
mutableprotected

For vector data of space dimension less or equal to 3.

int MGVector::m_sdim
protected

Friend Function.

Protected data member


このクラス詳解は次のファイルから抽出されました: