Add angle(vector,vector)
This commit is contained in:
parent
bea016fac0
commit
8780a2d7e5
1 changed files with 6 additions and 0 deletions
|
|
@ -314,6 +314,12 @@ namespace psemek::geom
|
||||||
return std::atan2(v[1], v[0]);
|
return std::atan2(v[1], v[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, std::size_t N>
|
||||||
|
T angle(vector<T, N> const & v0, vector<T, N> const & v1)
|
||||||
|
{
|
||||||
|
return std::acos(std::max(T{-1}, std::min(T{1}, dot(v0, v1))));
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T, std::size_t N>
|
template <typename T, std::size_t N>
|
||||||
vector<T, N> pointwise_mult(vector<T, N> const & v0, vector<T, N> const & v1)
|
vector<T, N> pointwise_mult(vector<T, N> const & v0, vector<T, N> const & v1)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue