X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;ds=sidebyside;f=include%2Fla.h;h=0ef6ee8210432e27fd937acc843e620ac555fcde;hb=6f30c5ef957e1775ff7e39a41e1e1aa99864dbd1;hp=bc6b32269d39ae2faee48e278ef43c3066bd8a1a;hpb=2e272c8234ed76c70119a71a8371c4c48b8d7a33;p=meshio%2Fmeshio.git diff --git a/include/la.h b/include/la.h index bc6b322..0ef6ee8 100644 --- a/include/la.h +++ b/include/la.h @@ -47,6 +47,16 @@ struct Vector3 { return x==rhs.x && y==rhs.y && z==rhs.z; } + + Vector3 operator+(const Vector3 &rhs) + { + return Vector3(x+rhs.x, y+rhs.y, z+rhs.z); + } + + Vector3 operator-(const Vector3 &rhs) + { + return Vector3(x-rhs.x, y-rhs.y, z-rhs.z); + } }; #ifndef SWIG inline std::ostream &operator<<(std::ostream &os, const Vector3 &rhs) @@ -93,6 +103,11 @@ struct Quaternion Quaternion(float _x, float _y, float _z, float _w) : x(_x), y(_y), z(_z), w(_w) {} + + float dot(const Quaternion &rhs) + { + return x*rhs.x + y*rhs.y + z*rhs.z + w*rhs.w; + } }; #ifndef SWIG inline std::ostream &operator<<(std::ostream &os, const Quaternion &rhs)