Skip to content

Commit

Permalink
Vector normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
Pencilcaseman committed Aug 1, 2023
1 parent 265559c commit c2066dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions librapid/include/librapid/math/vectorImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,11 @@ namespace librapid {

return Vector<Scalar, 3> {y1 * z2 - z1 * y2, z1 * x2 - x1 * z2, x1 * y2 - y1 * x2};
}

template<typename T, typename std::enable_if_t<IsVectorType<T>::value, int> = 0>
LIBRAPID_NODISCARD LIBRAPID_ALWAYS_INLINE auto norm(const T &val) {
return val / mag(val);
}
} // namespace librapid

LIBRAPID_SIMPLE_IO_IMPL(typename Derived, librapid::vectorDetail::VectorBase<Derived>);
Expand Down

0 comments on commit c2066dd

Please sign in to comment.