diff options
| author | Franklin Wei <me@fwei.tk> | 2019-05-30 23:03:58 -0400 |
|---|---|---|
| committer | Franklin Wei <me@fwei.tk> | 2019-05-30 23:03:58 -0400 |
| commit | f9be2ace4ca871d7ad68c1a4dbdcff87511d838b (patch) | |
| tree | 56dee4cf1b75b22f990c7aa169c7c57bb1116c3b /include/fml/vec3.h | |
| parent | ad380a22d4fc6b0fbd54388b79c93e736ff90e03 (diff) | |
| download | libfml-f9be2ace4ca871d7ad68c1a4dbdcff87511d838b.zip libfml-f9be2ace4ca871d7ad68c1a4dbdcff87511d838b.tar.gz libfml-f9be2ace4ca871d7ad68c1a4dbdcff87511d838b.tar.bz2 libfml-f9be2ace4ca871d7ad68c1a4dbdcff87511d838b.tar.xz | |
Add some useful stuff
Diffstat (limited to 'include/fml/vec3.h')
| -rw-r--r-- | include/fml/vec3.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/fml/vec3.h b/include/fml/vec3.h index 3460c56..a006619 100644 --- a/include/fml/vec3.h +++ b/include/fml/vec3.h @@ -5,6 +5,8 @@ #include "fml.h" namespace fml { + class quat; + class vec3 { public: scalar v[3]; @@ -27,7 +29,15 @@ namespace fml { scalar magnitudeSquared() const; vec3 normalize() const; scalar dot(const vec3 &other) const; + + /* order is this x other. */ vec3 cross(const vec3 &other) const; + + /* rotate by a rotation quaternion */ + vec3 rotateby(const quat &rotquat) const; + + /* return an arbitrary unit vector normal to other */ + static vec3 any_unit_normal(const vec3 &other); }; vec3 operator*(scalar scale, const vec3 &v); |