📄 as_transf.hxx
字号:
// Header for transf.// This class records a general transformation of 3D vectors. // It is in effect a 4 x 3 matrix to multiply a homogeneous vector,// but is stored specially to reflect the use to which it is put.#if !defined( TRANSF_CLASS )#define TRANSF_CLASS#include "as_vector.hxx"#include "as_matrix.hxx"class unit_vector;class transf { matrix affine_part; // always normalised: det == + or - 1 vector translation_part; double scaling_part; // Bit fields for flags: make them 2 bits rather than the obvious // 1, to allow for systems which make bit fields signed. logical rotate_flag : 2; // TRUE is there is a rotation logical reflect_flag : 2; // TRUE if there is a reflection logical shear_flag : 2; // TRUE if there is a shear logical identity_flag : 2; // TRUE if this is known to be the identity // Simple constructor. This is private, as we don't want to check // the matrix for unit determinant every time.public: // NOTE: This has been made public so read_transf can access it. // read_transf used to be its friend, but can't anymore since // they are now in two different components, or dlls. // bottom line: Be good and DONT USE THIS CONTRUCTOR! transf( matrix const &, vector const &, double, logical, logical, logical ); // WARNING: Don't use the above constructor! Treat it as private.public: transf(); // creates the identity transformation transf( transf const & ); // makes a copy //void update(); // check parameters to update status // Data reading routines. These all handle a null transformation // by treating it as the identity. matrix affine() const; vector translation() const; double scaling() const { return this == NULL ? 1 : scaling_part; } logical rotate() const { return this == NULL ? FALSE : rotate_flag; } logical reflect() const { return this == NULL ? FALSE : reflect_flag; } logical shear() const { return this == NULL ? FALSE : shear_flag; } logical identity() const { return this == NULL ? TRUE : identity_flag; } // Set all of the components of the transformation. Sets the // identity flag if all components are exactly right. friend transf restore_transf( matrix const &, vector const &, double, logical, logical, logical ); // Construction routines. All set the identity flag if the arguments // are == the appropriate values. // Set transformation to arg * identity. friend transf scale_transf( double ); // Set transformation to differential scaling. Note that such // a transformation is not supported in the rest of Acis. friend transf scale_transf( double, double, double ); // Set transformation to rotation by angle about vector. friend transf rotate_transf( double, vector const & ); // Set transformation to reflection about plane through // origin and perpendicular to given vector. friend transf reflect_transf( vector const & ); // Set transformation to translation along vector. friend transf translate_transf( vector const & ); // Set transformation to carry origin to given position, and // x and y axes to the given unit vectors. If the second unit // vector is not orthogonal to the first, uses instead a // unit vector in the plane of the two given vectors, that is. friend transf coordinate_transf( position const &, unit_vector const &, unit_vector const & ); // Compare two transformations. This does not allow any tolerance, // so is not a general equality operator, but may be assumed to // return TRUE if one argument is a copy of the other. logical operator==( transf const & ) const; logical operator!=( transf const &rhs ) const { return !(*this == rhs ); } // Multiply two transformations. friend transf operator*( transf const &, transf const & ); friend transf operator*( transf const &t1, transf const *t2 ) { return t1 * (*t2); } transf const &operator*=( transf const & ); // Return the inverse transformation (must be no shear in the // given transformation). transf inverse() const; // Transform a vector, ignoring the translation part of the // transformation. friend vector operator*( vector const &, transf const & ); // Transform a unit vector. Ignores the translation and // scaling parts, but complains if there is a shear friend unit_vector operator*( unit_vector const &, transf const & ); // Transform a position. Uses the complete 4x3 transformation. friend position operator*( position const &, transf const & ); // Make read_transf a friend so that the non-checking private // constructor can be used when reading a transf from file.// friend transf read_transf(); // We can't be friends anymore since we're in two different dlls. // Instead, the contructor above was made public, with serious warnings // about anyone using it except read_transf.};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -