⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit_vector.cpp

📁 basic mathematic classes used for math programming
💻 CPP
字号:
#include "mathclass.h"unit_vector x_axis( 1.0, 0.0, 0.0 );unit_vector y_axis( 0.0, 1.0, 0.0 );unit_vector z_axis( 0.0, 0.0, 1.0 );unit_vector normalize( vector const& a ){    m_real s = len(a);    if ( s != 0.0 )        return unit_vector( a.p[0]/s, a.p[1]/s, a.p[2]/s );    else        return unit_vector( 0.0, 0.0, 0.0);}int equal_normal( unit_vector const& u, unit_vector const& v ){    if ( len(u-v) < EPS ) return TRUE;                     else return FALSE;}ostream& operator<<( ostream& os, unit_vector const& a ){    os << "( " << a.p[0] << " , " << a.p[1] << " , " << a.p[2] << " )";    return os;}istream& operator>>( istream& is, unit_vector& a ){
	static char	buf[256];    //is >> "(" >> a.p[0] >> "," >> a.p[1] >> "," >> a.p[2] >> ")";
	is >> buf >> a.p[0] >> buf >> a.p[1] >> buf >> a.p[2] >> buf;    return is;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -