Rename cross(v,v) to ort(v...), cross left as convenience

This commit is contained in:
Nikita Lisitsa 2020-09-13 10:34:50 +03:00
parent 6844a01a8f
commit 007fd12240

View file

@ -233,8 +233,15 @@ namespace psemek::geom
;
}
// TODO: generic implementation (shares internals with det)
template <typename T>
vector<T, 3> cross(vector<T, 3> const & v0, vector<T, 3> const & v1)
vector<T, 2> ort(vector<T, 2> const & v0)
{
return {-v0[1], v0[0]};
}
template <typename T>
vector<T, 3> ort(vector<T, 3> const & v0, vector<T, 3> const & v1)
{
return vector<T, 3>{
v0[1] * v1[2] - v0[2] * v1[1],
@ -243,6 +250,12 @@ namespace psemek::geom
};
}
template <typename T>
vector<T, 3> cross(vector<T, 3> const & v0, vector<T, 3> const & v1)
{
return ort(v0, v1);
}
template <typename T>
T lerp(T const & x0, T const & x1, T const & t)
{