MGCL V10
V10
MGCL V10
|
Vector of a general n space dimension. [詳解]
公開メンバ関数 | |
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 () | |
MGVector & | operator= (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) |
MGVector & | operator= (const double *) |
Update vector data by array of double. [詳解] | |
MGVector & | operator+= (const MGVector &) |
MGVector | operator- () const |
MGVector & | operator-= (const MGVector &) |
MGVector & | operator*= (double scale) |
MGVector & | operator*= (const MGVector &vec2) |
Update own vector by vector product output, changes to 3D vector. [詳解] | |
MGVector & | operator/= (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 |
MGVector & | clear (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.
|
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.
Construct a vector from a difference of two vectors.
dvec | Destination point |
svec | Source 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).
sdim | Space dimension. |
vec2 | Original vector. |
start1 | id of constructing vector that indicates from where to store the elements of vec2. |
start2 | id 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);
|
inline |
double MGVector::angle | ( | const MGVector & | ) | const |
自身のベクトルと与えられたベクトルのなす角度を Radian で返却 Compute angle in radian of two vectors. 0<= angle <pai.
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.
|
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.
|
inline |
Return the 1st address of the array of the vector double data.
|
inline |
int MGVector::dump | ( | MGOfstream & | ) | const |
Dump Function.
int MGVector::dump_size | ( | ) | const |
Dump Functions. Calculate dump size
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.
|
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.
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.
|
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.
|
inline |
Negate the vector.
MGUnit_vector MGVector::normalize | ( | ) | const |
一般ベクトルを単位ベクトル化しオブジェクトを生成 Generate unit vector from the vector.
|
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.
Update own vector by vector product output, changes to 3D vector.
自身のベクトルに与えられたベクトルを加算して自身のベクトルとする Addition of two vectors.
MGVector MGVector::operator- | ( | ) | const |
単項マイナス。自身のベクトルを反転し、オブジェクトを生成 Unary minus. Negate all the elements of the vector.
自身のベクトルから与えられたベクトルを減算し自身のベクトルとする Subtraction of two vectors.
MGVector& MGVector::operator/= | ( | double | scale | ) |
スカラー除算を行い自身のベクトルとする Scalar division.
MGVector& MGVector::operator= | ( | const double * | ) |
Update vector data by array of double.
|
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.
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.
自身のベクトルをベクトル(v2)に射影したベクトルを求める。 v2 が 零ベクトルのとき(*this)が返る。
|
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.
|
inline |
Get the space dimension.
|
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.
i | Displacement of *this. |
vec2 | Vector 2. |
j | Displacement 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.
i | Displacement of *this. |
vec2 | Vector 2. |
j | Displacement of vec2. |
len | Length to store |
void MGVector::swap | ( | int | i, |
int | j | ||
) |
swap two coordinates. swap coordinates (i) and (j).
|
friend |
3つのベクトルから求められる行列の行列式の値を返却する。 Determinant of 3 by 3 matrix of 3 vectors.
与えられたベクトルの成分の値を比較し、not equalのとき TRUE を返却 Test if two vectors are equal.
ベクトルの内積 Inner product of two vectors.
ベクタの外積 vector product of two vectors.
スカラーの乗算を行いオブジェクトを生成 Scalar multiplication.
ベクトルのスカラー乗算を行いオブジェクトを生成 Scalar multiplication.
ベクトルの加算 Addition of two vectors.
ベクトルの減算 Subtraction of two vectors.
スカラー除算を行いオブジェクトを生成 Scalar division.
Test if this vector is less than v2. Comparison depends on two vectors' length.
|
friend |
String stream function.
与えられたベクトルの成分の値を比較し、同じであれば TRUE を返却 Test if two vectors are equal.
|
protected |
|
protected |
|
mutableprotected |
For vector data of space dimension less or equal to 3.
|
protected |
Friend Function.
Protected data member