aboutsummaryrefslogtreecommitdiffstats
path: root/include/jau/float_math.hpp
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-04-13 17:58:26 +0200
committerSven Göthel <[email protected]>2024-04-13 17:58:26 +0200
commitad15f9500c334bca2c4f78d58705f84e6a424097 (patch)
tree96d82ad3f7394fb06d9189cc7cf3468c07fea2a3 /include/jau/float_math.hpp
parent519de147c316c6aa471cb1f01b21b68b099b4893 (diff)
math: Add std::ostream operator<<(..) to all types; string_util: Add [v]format_string(..) for [v]printf(..) formatting a string
Diffstat (limited to 'include/jau/float_math.hpp')
-rw-r--r--include/jau/float_math.hpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/jau/float_math.hpp b/include/jau/float_math.hpp
index ee7c65d..cb44c33 100644
--- a/include/jau/float_math.hpp
+++ b/include/jau/float_math.hpp
@@ -498,6 +498,37 @@ namespace jau {
return rad * (T)180.0 / (T)M_PI;
}
+ /**
+ * Appends a row of floating points to the given string `sb`
+ * @param sb string buffer to appends to
+ * @param f format string for each float element, e.g. "%10.5f"
+ * @param a the float data of size rows x columns
+ * @param rows float data `a` size row factor
+ * @param columns float data `a` size column factor
+ * @param rowMajorOrder if true floats are laid out in row-major-order, otherwise column-major-order (OpenGL)
+ * @param row selected row of float data `a`
+ * @return given string buffer `sb` for chaining
+ */
+ std::string& row_to_string(std::string& sb, const std::string& f,
+ const float a[],
+ const jau::nsize_t rows, const jau::nsize_t columns,
+ const bool rowMajorOrder, const jau::nsize_t row) noexcept;
+
+ /**
+ * Appends a matrix of floating points to the given string `sb`
+ * @param sb string buffer to appends to
+ * @param rowPrefix prefix for each row
+ * @param f format string for each float element, e.g. "%10.5f"
+ * @param a the float data of size rows x columns
+ * @param rows float data `a` size row factor
+ * @param columns float data `a` size column factor
+ * @param rowMajorOrder if true floats are laid out in row-major-order, otherwise column-major-order (OpenGL)
+ * @return given string buffer `sb` for chaining
+ */
+ std::string& mat_to_string(std::string& sb, const std::string& rowPrefix, const std::string& f,
+ const float a[], const jau::nsize_t rows, const jau::nsize_t columns,
+ const bool rowMajorOrder) noexcept;
+
/**@}*/
} // namespace jau