diff options
Diffstat (limited to 'src/math/vector3f.h')
-rw-r--r-- | src/math/vector3f.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/math/vector3f.h b/src/math/vector3f.h index a7437aa..7cd533d 100644 --- a/src/math/vector3f.h +++ b/src/math/vector3f.h @@ -225,6 +225,13 @@ inline btVector3 to_btVector3(const math::Vector3f & v) return btVector3(v[0], v[1], v[2]); } +/// calculate the normal of a plane defined by three vertices +inline const Vector3f normal(const Vector3f & first, const Vector3f & second, const Vector3f & third) { + Vector3f r = crossproduct(second - first, third - first); + r.normalize(); + return r; +} + } // namespace math #endif // __INCLUDED_MATH_VECTOR3F_H__ |