Add geom::isfinite for some primitive types
This commit is contained in:
parent
168cca63e3
commit
703ba37394
4 changed files with 33 additions and 0 deletions
|
|
@ -338,4 +338,13 @@ namespace psemek::geom
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, std::size_t N>
|
||||||
|
bool isfinite(box<T, N> const & b)
|
||||||
|
{
|
||||||
|
for (std::size_t i = 0; i < N; ++i)
|
||||||
|
if (!isfinite(b[i]))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -288,4 +288,10 @@ namespace psemek::geom
|
||||||
return expand(i, -d);
|
return expand(i, -d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool isfinite(interval<T> const & i)
|
||||||
|
{
|
||||||
|
return std::isfinite(i.min) && std::isfinite(i.max);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,15 @@ namespace psemek::geom
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, std::size_t N>
|
||||||
|
bool isfinite(point<T, N> const & p)
|
||||||
|
{
|
||||||
|
for (std::size_t i = 0; i < N; ++i)
|
||||||
|
if (!std::isfinite(p[i]))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
|
|
|
||||||
|
|
@ -402,6 +402,15 @@ namespace psemek::geom
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, std::size_t N>
|
||||||
|
bool isfinite(vector<T, N> const & v)
|
||||||
|
{
|
||||||
|
for (std::size_t i = 0; i < N; ++i)
|
||||||
|
if (!std::isfinite(v[i]))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue