Add geom::project_from
This commit is contained in:
parent
47d3156c57
commit
718d0c7d04
1 changed files with 7 additions and 0 deletions
|
|
@ -390,6 +390,13 @@ namespace psemek::geom
|
|||
}
|
||||
}
|
||||
|
||||
// Return vector orthogonal to n
|
||||
template <typename T, std::size_t N>
|
||||
vector<T, N> project_from(vector<T, N> const & v, vector<T, N> const & n)
|
||||
{
|
||||
return v - n * (dot(v, n) / dot(n, n));
|
||||
}
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
std::ostream & operator << (std::ostream & os, vector<T, N> const & v)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue