Add geom::sign function
This commit is contained in:
parent
d470fe7346
commit
d5495a52ce
1 changed files with 11 additions and 0 deletions
|
|
@ -8,6 +8,17 @@
|
|||
namespace psemek::geom
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
T sign(T const & x)
|
||||
{
|
||||
if (x > 0)
|
||||
return 1;
|
||||
else if (x < 0)
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
auto sqr(T const & x)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue