We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8b36cc5 commit 22f6bb6Copy full SHA for 22f6bb6
examples/pico_toolshed/pico_toolshed/point.hpp
@@ -10,6 +10,8 @@
10
//! \tparam Dim_ The dimension of the space in which the point resides.
11
template <typename Scalar_, int Dim_>
12
class Point {
13
+ static_assert(Dim_ > 0, "INVALID_SPATIAL_DIMENSION_POINT");
14
+
15
public:
16
using ScalarType = Scalar_;
17
static constexpr int Dim = Dim_;
@@ -23,6 +25,15 @@ class Point {
23
25
}
24
26
27
28
+ template <typename OtherScalarType>
29
+ inline Point<OtherScalarType, Dim> Cast() const {
30
+ Point<OtherScalarType, Dim> other;
31
+ for (int i = 0; i < Dim; ++i) {
32
+ other.data[i] = static_cast<OtherScalarType>(data[i]);
33
+ }
34
+ return other;
35
36
37
ScalarType data[Dim];
38
};
39
0 commit comments