📄 as_unitvec.hxx
字号:
// Header for unit_vector.// Unit vectors work just like vectors, and so are a derived type. #if !defined( UNITVEC_CLASS )#define UNITVEC_CLASS#include "as_vector.hxx"class transf;class interval;class unit_vector: public vector {public: unit_vector() {} // allow unitialised unit_vectors // Construct a unit vector from three components. // Always normalises result. unit_vector( double, double, double ); // Construct a unit vector from an array of three doubles. // Always normalises result. unit_vector( double u[ 3 ] ); // Unary minus. friend unit_vector operator-( unit_vector const & ); // Scalar product of a position. This is just as for a vector, // but declared explicitly to avoid an ambiguity. friend double operator%( position const &, unit_vector const & ); friend double operator%( unit_vector const &, position const & ); // Find a position as the cross-product of a position with a // unit vector. friend position operator*( position const &, unit_vector const & ); friend position operator*( unit_vector const &, position const & ); // The only way to get back from a vector to a unit_vector is by // means of normalise(). We make it explicit, and have no // constructor from vector to unit_vector in order to make clear // the change in value. friend unit_vector normalise( vector const & ); // Transform a unit vector by the rotation matrix in a // transformation (gives an error if the transformation contains // a shear). friend unit_vector operator*( unit_vector const &, transf const & ); friend unit_vector operator*( unit_vector const &, transf const * ); unit_vector const &operator*=( transf const & );};// Standard axis vectors: (1,0,0), (0,1,0), (0,0,1)extern unit_vector x_axis, y_axis, z_axis;// Zero length "unit vector", used for signalling exceptional// conditions.#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -