#ifndef VECTOR_H_FILE #define VECTOR_H_FILE //作者: 黄海波,张嘉骞,中国科学技术大学 template class vector3 { public: vector3(myType x, myType y, myType z); vector3(); myType dot(vector3 other); vector3 cross(vector3 other); myType norm_square(); myType x; myType y; myType z; myType get_x() const { return x; } myType get_y() const { return y; } myType get_z() const { return z; } vector3 operator- (const vector3& rhs) const { return vector3(x - rhs.x, y - rhs.y, z - rhs.z); } vector3 operator+ (const vector3& rhs) const { return vector3(x + rhs.x, y + rhs.y, z + rhs.z); } vector3 operator/ (const myType& rhs) const { return vector3(x/rhs, y/rhs, z/rhs); } }; #endif