From 4fe50d12d08d811858d8fe87e58fb066f856d569 Mon Sep 17 00:00:00 2001 From: madrocketsci Date: Wed, 11 Mar 2026 14:23:36 -0400 Subject: [PATCH] added vector interconversions --- amsmathutil25_vec_conversions.cpp.tmp | 504 +++++++++++++++++ amsmathutil25_vec_conversions.hpp.tmp | 81 +++ build_linux64/libamsmathutil25.linux64.a | Bin 468572 -> 496852 bytes build_linux64/objstore/amsmathutil25_vec2i.o | Bin 0 -> 3056 bytes build_linux64/objstore/amsmathutil25_vec3i.o | Bin 0 -> 3200 bytes build_linux64/objstore/amsmathutil25_vec4i.o | Bin 0 -> 3232 bytes .../objstore/amsmathutil25_vecconversions.o | Bin 0 -> 13000 bytes .../amsmathutil25/math/amsmathutil25_math.hpp | 4 + .../math/amsmathutil25_mathpredeclare.hpp | 33 ++ .../amsmathutil25/math/amsmathutil25_vec2.hpp | 10 + .../math/amsmathutil25_vec2f.hpp | 10 + .../math/amsmathutil25_vec2i.hpp | 22 +- .../amsmathutil25/math/amsmathutil25_vec3.hpp | 10 + .../math/amsmathutil25_vec3f.hpp | 10 + .../math/amsmathutil25_vec3i.hpp | 45 ++ .../amsmathutil25/math/amsmathutil25_vec4.hpp | 11 + .../math/amsmathutil25_vec4f.hpp | 11 + .../math/amsmathutil25_vec4i.hpp | 47 ++ include/amsmathutil25/math/genconversions.py | 63 +++ .../math/amsmathutil25_vec2i.cpp | 108 ++++ .../math/amsmathutil25_vec3i.cpp | 122 +++++ .../math/amsmathutil25_vec4f.cpp | 3 + .../math/amsmathutil25_vec4i.cpp | 131 +++++ .../math/amsmathutil25_vecconversions.cpp | 512 ++++++++++++++++++ 24 files changed, 1732 insertions(+), 5 deletions(-) create mode 100644 amsmathutil25_vec_conversions.cpp.tmp create mode 100644 amsmathutil25_vec_conversions.hpp.tmp create mode 100644 build_linux64/objstore/amsmathutil25_vec2i.o create mode 100644 build_linux64/objstore/amsmathutil25_vec3i.o create mode 100644 build_linux64/objstore/amsmathutil25_vec4i.o create mode 100644 build_linux64/objstore/amsmathutil25_vecconversions.o create mode 100644 include/amsmathutil25/math/amsmathutil25_mathpredeclare.hpp create mode 100644 include/amsmathutil25/math/amsmathutil25_vec3i.hpp create mode 100644 include/amsmathutil25/math/amsmathutil25_vec4i.hpp create mode 100644 include/amsmathutil25/math/genconversions.py create mode 100644 src/amsmathutil25/math/amsmathutil25_vec2i.cpp create mode 100644 src/amsmathutil25/math/amsmathutil25_vec3i.cpp create mode 100644 src/amsmathutil25/math/amsmathutil25_vec4i.cpp create mode 100644 src/amsmathutil25/math/amsmathutil25_vecconversions.cpp diff --git a/amsmathutil25_vec_conversions.cpp.tmp b/amsmathutil25_vec_conversions.cpp.tmp new file mode 100644 index 0000000..3b538dd --- /dev/null +++ b/amsmathutil25_vec_conversions.cpp.tmp @@ -0,0 +1,504 @@ +vec2::vec2(const vec3 rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec4 rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec2f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec3f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec4f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec2i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec3i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec4i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec2 rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec4 rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec2f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec3f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec4f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec2i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec3i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec4i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec2 rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec3 rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec2f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec3f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec4f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec2i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec3i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec4i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2f::vec2f(const vec2 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec3 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec4 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec3f rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec4f rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec2i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec3i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec4i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec2 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec3 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec4 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec2f rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec4f rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec2i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec3i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec4i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec2 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec3 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec4 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec2f rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec3f rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec2i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec3i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec4i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2i::vec2i(const vec2 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec3 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec4 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec2f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec3f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec4f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec3i rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec4i rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec2 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec3 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec4 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec2f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec3f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec4f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec2i rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec4i rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec2 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec3 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec4 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec2f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec3f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec4f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec2i rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec3i rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + diff --git a/amsmathutil25_vec_conversions.hpp.tmp b/amsmathutil25_vec_conversions.hpp.tmp new file mode 100644 index 0000000..6d3597a --- /dev/null +++ b/amsmathutil25_vec_conversions.hpp.tmp @@ -0,0 +1,81 @@ +explicit vec2::vec2(const vec3 rhs); +explicit vec2::vec2(const vec4 rhs); +explicit vec2::vec2(const vec2f rhs); +explicit vec2::vec2(const vec3f rhs); +explicit vec2::vec2(const vec4f rhs); +explicit vec2::vec2(const vec2i rhs); +explicit vec2::vec2(const vec3i rhs); +explicit vec2::vec2(const vec4i rhs); + +explicit vec3::vec3(const vec2 rhs); +explicit vec3::vec3(const vec4 rhs); +explicit vec3::vec3(const vec2f rhs); +explicit vec3::vec3(const vec3f rhs); +explicit vec3::vec3(const vec4f rhs); +explicit vec3::vec3(const vec2i rhs); +explicit vec3::vec3(const vec3i rhs); +explicit vec3::vec3(const vec4i rhs); + +explicit vec4::vec4(const vec2 rhs); +explicit vec4::vec4(const vec3 rhs); +explicit vec4::vec4(const vec2f rhs); +explicit vec4::vec4(const vec3f rhs); +explicit vec4::vec4(const vec4f rhs); +explicit vec4::vec4(const vec2i rhs); +explicit vec4::vec4(const vec3i rhs); +explicit vec4::vec4(const vec4i rhs); + +explicit vec2f::vec2f(const vec2 rhs); +explicit vec2f::vec2f(const vec3 rhs); +explicit vec2f::vec2f(const vec4 rhs); +explicit vec2f::vec2f(const vec3f rhs); +explicit vec2f::vec2f(const vec4f rhs); +explicit vec2f::vec2f(const vec2i rhs); +explicit vec2f::vec2f(const vec3i rhs); +explicit vec2f::vec2f(const vec4i rhs); + +explicit vec3f::vec3f(const vec2 rhs); +explicit vec3f::vec3f(const vec3 rhs); +explicit vec3f::vec3f(const vec4 rhs); +explicit vec3f::vec3f(const vec2f rhs); +explicit vec3f::vec3f(const vec4f rhs); +explicit vec3f::vec3f(const vec2i rhs); +explicit vec3f::vec3f(const vec3i rhs); +explicit vec3f::vec3f(const vec4i rhs); + +explicit vec4f::vec4f(const vec2 rhs); +explicit vec4f::vec4f(const vec3 rhs); +explicit vec4f::vec4f(const vec4 rhs); +explicit vec4f::vec4f(const vec2f rhs); +explicit vec4f::vec4f(const vec3f rhs); +explicit vec4f::vec4f(const vec2i rhs); +explicit vec4f::vec4f(const vec3i rhs); +explicit vec4f::vec4f(const vec4i rhs); + +explicit vec2i::vec2i(const vec2 rhs); +explicit vec2i::vec2i(const vec3 rhs); +explicit vec2i::vec2i(const vec4 rhs); +explicit vec2i::vec2i(const vec2f rhs); +explicit vec2i::vec2i(const vec3f rhs); +explicit vec2i::vec2i(const vec4f rhs); +explicit vec2i::vec2i(const vec3i rhs); +explicit vec2i::vec2i(const vec4i rhs); + +explicit vec3i::vec3i(const vec2 rhs); +explicit vec3i::vec3i(const vec3 rhs); +explicit vec3i::vec3i(const vec4 rhs); +explicit vec3i::vec3i(const vec2f rhs); +explicit vec3i::vec3i(const vec3f rhs); +explicit vec3i::vec3i(const vec4f rhs); +explicit vec3i::vec3i(const vec2i rhs); +explicit vec3i::vec3i(const vec4i rhs); + +explicit vec4i::vec4i(const vec2 rhs); +explicit vec4i::vec4i(const vec3 rhs); +explicit vec4i::vec4i(const vec4 rhs); +explicit vec4i::vec4i(const vec2f rhs); +explicit vec4i::vec4i(const vec3f rhs); +explicit vec4i::vec4i(const vec4f rhs); +explicit vec4i::vec4i(const vec2i rhs); +explicit vec4i::vec4i(const vec3i rhs); + diff --git a/build_linux64/libamsmathutil25.linux64.a b/build_linux64/libamsmathutil25.linux64.a index b4b1f64c0e8ed8a85f966f7e6cf8bfd1f230c6ac..6996fbdcc49242fd17c9236a43609b20993d599b 100644 GIT binary patch delta 23269 zcmeHPe{fVqo_{m*-pqi*%!I^Dh(HF6ZbXquGALnTZvu=)7a;;FB}5W|NHoCUuVU|9 zUN|_9F{_R@xUGAf75Cgb_QVi>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}L2I9NK7Z7Lh{NC0#!5<^O1pXxP7Wi)B%iv|= z<`G%gs>JO$P7%)`ewBCu@dEJ@;x~y8BECx8j_)S%3S#@AvFlRPz6Z=p z@j2r5xo(i3ePOaXe8?QDGtqI}o>fQZszLtnaCJDyADW#F@*~relcQ6HO-)xv^X9){ zZkeqPk35g~xv8W1%FJ|Sbf)@3ke?Zy7|xH59~_$*o*a!lTg~rBjaY6u=Jjl%l@R?D z^RvmUJ;Cvl<|ul6yyEO%NM{qcz1cAMlsPl66z^HT*=XgO1@ohu?O*b`+5YWun@QSp zUDw46f+W}OGTglCjqVZZ0^QK(6q8e#t8U*kfm~BQ=eqSmf1cKn_45B{Web$F*qk?d zBhbWk%xlbWoL0Xc^{&1p)xwL6Me|-ont3f4dc=CUE_*Na^N+~yAh>1TYv{)7C+}}u P`tsID^_&))bJo8PsblJQ literal 0 HcmV?d00001 diff --git a/include/amsmathutil25/math/amsmathutil25_math.hpp b/include/amsmathutil25/math/amsmathutil25_math.hpp index bb20a19..b10d7db 100644 --- a/include/amsmathutil25/math/amsmathutil25_math.hpp +++ b/include/amsmathutil25/math/amsmathutil25_math.hpp @@ -23,6 +23,7 @@ static const double vecmat_det_small = 1.0E-15; }; //end namespace ams +#include #include #include #include @@ -32,6 +33,9 @@ static const double vecmat_det_small = 1.0E-15; #include #include #include +#include +#include +#include #endif diff --git a/include/amsmathutil25/math/amsmathutil25_mathpredeclare.hpp b/include/amsmathutil25/math/amsmathutil25_mathpredeclare.hpp new file mode 100644 index 0000000..7766e59 --- /dev/null +++ b/include/amsmathutil25/math/amsmathutil25_mathpredeclare.hpp @@ -0,0 +1,33 @@ +#ifndef __AMSMATHUTIL25_MATHPREDECLARE_HPP__ +#define __AMSMATHUTIL25_MATHPREDECLARE_HPP__ + +namespace ams +{ + + //Pre-declarations for interconversion + + class vec2; + class vec2f; + class mat2; + class mat2f; + + class vec2i; + + class vec3; + class vec3f; + class mat3; + class mat3f; + + class vec3i; + + class vec4; + class vec4f; + class mat4; + class mat4f; + + class vec4i; + + +}; + +#endif \ No newline at end of file diff --git a/include/amsmathutil25/math/amsmathutil25_vec2.hpp b/include/amsmathutil25/math/amsmathutil25_vec2.hpp index c132286..ebc20fc 100644 --- a/include/amsmathutil25/math/amsmathutil25_vec2.hpp +++ b/include/amsmathutil25/math/amsmathutil25_vec2.hpp @@ -24,6 +24,16 @@ public: double& operator[](int ind); const double& operator[](int ind) const; + + //explicit conversions for casting + explicit vec2(const vec3 rhs); + explicit vec2(const vec4 rhs); + explicit vec2(const vec2f rhs); + explicit vec2(const vec3f rhs); + explicit vec2(const vec4f rhs); + explicit vec2(const vec2i rhs); + explicit vec2(const vec3i rhs); + explicit vec2(const vec4i rhs); }; //vector operations diff --git a/include/amsmathutil25/math/amsmathutil25_vec2f.hpp b/include/amsmathutil25/math/amsmathutil25_vec2f.hpp index 883552d..bb6631f 100644 --- a/include/amsmathutil25/math/amsmathutil25_vec2f.hpp +++ b/include/amsmathutil25/math/amsmathutil25_vec2f.hpp @@ -24,6 +24,16 @@ public: float& operator[](int ind); const float& operator[](int ind) const; + + //explicit conversions for casting + explicit vec2f(const vec2 rhs); + explicit vec2f(const vec3 rhs); + explicit vec2f(const vec4 rhs); + explicit vec2f(const vec3f rhs); + explicit vec2f(const vec4f rhs); + explicit vec2f(const vec2i rhs); + explicit vec2f(const vec3i rhs); + explicit vec2f(const vec4i rhs); }; //vector operations diff --git a/include/amsmathutil25/math/amsmathutil25_vec2i.hpp b/include/amsmathutil25/math/amsmathutil25_vec2i.hpp index 205cbe0..88bad83 100644 --- a/include/amsmathutil25/math/amsmathutil25_vec2i.hpp +++ b/include/amsmathutil25/math/amsmathutil25_vec2i.hpp @@ -11,21 +11,33 @@ public: int y; vec2i(); - vec2i(float _x, float _y); + vec2i(int _x, int _y); vec2i(const vec2i &rhs); vec2i& operator=(const vec2i &rhs); bool operator==(const vec2i rhs) const; vec2i operator+(vec2i rhs) const; vec2i operator-(vec2i rhs) const; - vec2i operator*(float rhs) const; - vec2i operator/(float rhs) const; + vec2i operator*(int rhs) const; + vec2i operator/(int rhs) const; friend vec2i operator-(vec2i rhs); - float& operator[](int ind); - const float& operator[](int ind) const; + int& operator[](int ind); + const int& operator[](int ind) const; + + //explicit conversion constructors for casting + explicit vec2i(const vec2 rhs); + explicit vec2i(const vec3 rhs); + explicit vec2i(const vec4 rhs); + explicit vec2i(const vec2f rhs); + explicit vec2i(const vec3f rhs); + explicit vec2i(const vec4f rhs); + explicit vec2i(const vec3i rhs); + explicit vec2i(const vec4i rhs); }; }; + +#endif \ No newline at end of file diff --git a/include/amsmathutil25/math/amsmathutil25_vec3.hpp b/include/amsmathutil25/math/amsmathutil25_vec3.hpp index 9d20220..58d0766 100644 --- a/include/amsmathutil25/math/amsmathutil25_vec3.hpp +++ b/include/amsmathutil25/math/amsmathutil25_vec3.hpp @@ -29,6 +29,16 @@ public: double& operator[](int ind); const double& operator[](int ind) const; + + //explicit conversion constructors for casting + explicit vec3(const vec2 rhs); + explicit vec3(const vec4 rhs); + explicit vec3(const vec2f rhs); + explicit vec3(const vec3f rhs); + explicit vec3(const vec4f rhs); + explicit vec3(const vec2i rhs); + explicit vec3(const vec3i rhs); + explicit vec3(const vec4i rhs); }; //vector operations diff --git a/include/amsmathutil25/math/amsmathutil25_vec3f.hpp b/include/amsmathutil25/math/amsmathutil25_vec3f.hpp index 85a4e25..e9d3c2c 100644 --- a/include/amsmathutil25/math/amsmathutil25_vec3f.hpp +++ b/include/amsmathutil25/math/amsmathutil25_vec3f.hpp @@ -29,6 +29,16 @@ public: float& operator[](int ind); const float& operator[](int ind) const; + + //explicit conversion constructors for casting + explicit vec3f(const vec2 rhs); + explicit vec3f(const vec3 rhs); + explicit vec3f(const vec4 rhs); + explicit vec3f(const vec2f rhs); + explicit vec3f(const vec4f rhs); + explicit vec3f(const vec2i rhs); + explicit vec3f(const vec3i rhs); + explicit vec3f(const vec4i rhs); }; //vector operations diff --git a/include/amsmathutil25/math/amsmathutil25_vec3i.hpp b/include/amsmathutil25/math/amsmathutil25_vec3i.hpp new file mode 100644 index 0000000..43e1ea8 --- /dev/null +++ b/include/amsmathutil25/math/amsmathutil25_vec3i.hpp @@ -0,0 +1,45 @@ +#ifndef __AMSMATHUTIL25_VEC3I_HPP__ +#define __AMSMATHUTIL25_VEC3I_HPP__ + +namespace ams +{ + +class vec3i +{ +public: + int x; + int y; + int z; + + vec3i(); + vec3i(int _x, int _y, int z); + vec3i(const vec3i &rhs); + vec3i& operator=(const vec3i &rhs); + bool operator==(const vec3i rhs) const; + + vec3i operator+(vec3i rhs) const; + vec3i operator-(vec3i rhs) const; + vec3i operator*(int rhs) const; + vec3i operator/(int rhs) const; + friend vec3i operator-(vec3i rhs); + + int& operator[](int ind); + const int& operator[](int ind) const; + + //explicit conversion constructors for casting + explicit vec3i(const vec2 rhs); + explicit vec3i(const vec3 rhs); + explicit vec3i(const vec4 rhs); + explicit vec3i(const vec2f rhs); + explicit vec3i(const vec3f rhs); + explicit vec3i(const vec4f rhs); + explicit vec3i(const vec2i rhs); + explicit vec3i(const vec4i rhs); + +}; + + + +}; + +#endif \ No newline at end of file diff --git a/include/amsmathutil25/math/amsmathutil25_vec4.hpp b/include/amsmathutil25/math/amsmathutil25_vec4.hpp index 022b76a..9676bd2 100644 --- a/include/amsmathutil25/math/amsmathutil25_vec4.hpp +++ b/include/amsmathutil25/math/amsmathutil25_vec4.hpp @@ -29,6 +29,17 @@ public: double& operator[](int ind); const double& operator[](int ind) const; + + //explicit conversion constructors for casting + explicit vec4(const vec2 rhs); + explicit vec4(const vec3 rhs); + explicit vec4(const vec2f rhs); + explicit vec4(const vec3f rhs); + explicit vec4(const vec4f rhs); + explicit vec4(const vec2i rhs); + explicit vec4(const vec3i rhs); + explicit vec4(const vec4i rhs); + }; //vector operations diff --git a/include/amsmathutil25/math/amsmathutil25_vec4f.hpp b/include/amsmathutil25/math/amsmathutil25_vec4f.hpp index 070b62d..ecc57eb 100644 --- a/include/amsmathutil25/math/amsmathutil25_vec4f.hpp +++ b/include/amsmathutil25/math/amsmathutil25_vec4f.hpp @@ -29,6 +29,17 @@ public: float& operator[](int ind); const float& operator[](int ind) const; + + //explicit conversion constructors for casting + explicit vec4f(const vec2 rhs); + explicit vec4f(const vec3 rhs); + explicit vec4f(const vec4 rhs); + explicit vec4f(const vec2f rhs); + explicit vec4f(const vec3f rhs); + explicit vec4f(const vec2i rhs); + explicit vec4f(const vec3i rhs); + explicit vec4f(const vec4i rhs); + }; //vector operations diff --git a/include/amsmathutil25/math/amsmathutil25_vec4i.hpp b/include/amsmathutil25/math/amsmathutil25_vec4i.hpp new file mode 100644 index 0000000..6cc4643 --- /dev/null +++ b/include/amsmathutil25/math/amsmathutil25_vec4i.hpp @@ -0,0 +1,47 @@ +#ifndef __AMSMATHUTIL25_VEC4I_HPP__ +#define __AMSMATHUTIL25_VEC4I_HPP__ + +namespace ams +{ + +class vec4i +{ +public: + int x; + int y; + int z; + int w; + + vec4i(); + vec4i(int _x, int _y, int _z, int _w); + vec4i(const vec4i &rhs); + vec4i& operator=(const vec4i &rhs); + bool operator==(const vec4i rhs) const; + + vec4i operator+(vec4i rhs) const; + vec4i operator-(vec4i rhs) const; + vec4i operator*(int rhs) const; + vec4i operator/(int rhs) const; + friend vec4i operator-(vec4i rhs); + + int& operator[](int ind); + const int& operator[](int ind) const; + + //explicit conversion constructors for casting + explicit vec4i(const vec2 rhs); + explicit vec4i(const vec3 rhs); + explicit vec4i(const vec4 rhs); + explicit vec4i(const vec2f rhs); + explicit vec4i(const vec3f rhs); + explicit vec4i(const vec4f rhs); + explicit vec4i(const vec2i rhs); + explicit vec4i(const vec3i rhs); + + +}; + + + +}; + +#endif \ No newline at end of file diff --git a/include/amsmathutil25/math/genconversions.py b/include/amsmathutil25/math/genconversions.py new file mode 100644 index 0000000..7abc843 --- /dev/null +++ b/include/amsmathutil25/math/genconversions.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 + +import os,sys,math +import numpy as np + + + +dtype = ['d','f','i'] +dtxt = ['','f','i'] +convtxt = ['double','float','int'] +dim = [2,3,4] + +headertxt = "" +bodytxt = "" + +for I in range(0,len(dtype)): + for J in range(0,len(dim)): + for K in range(0,len(dtype)): + for L in range(0,len(dim)): + if(I==K and J==L): + continue + else: + #generate a converter + ttxt = "vec{:d}{:s}".format(dim[J],dtxt[I]) + ftxt = "vec{:d}{:s}".format(dim[L],dtxt[K]) + + + + body = "" + body += "{}::{}(const {} rhs)\n".format(ttxt,ttxt,ftxt) + body += "{\n" + body += " x = ({})rhs.x;\n".format(convtxt[I]) + body += " y = ({})rhs.y;\n".format(convtxt[I]) + if(J>=3): + if(L>=3): + body += " z = ({})rhs.z;\n".format(convtxt[I]) + else: + body += " z = 0;\n".format(convtxt[I]) + if(J>=4): + if(L>=4): + body += " w = ({})rhs.w;\n".format(convtxt[I]) + else: + body += " w = 0;\n".format(convtxt[I]) + body += " return;\n" + body += "}\n\n" + + + head = "explicit {}::{}(const {} rhs);\n".format(ttxt,ttxt,ftxt) + + headertxt+=head + bodytxt+=body + + headertxt+="\n" + + +fp = open("./amsmathutil25_vec_conversions.hpp.tmp","w+") +fp.write(headertxt) +fp.close() +fp = open("./amsmathutil25_vec_conversions.cpp.tmp","w+") +fp.write(bodytxt) +fp.close() + + diff --git a/src/amsmathutil25/math/amsmathutil25_vec2i.cpp b/src/amsmathutil25/math/amsmathutil25_vec2i.cpp new file mode 100644 index 0000000..1039f3d --- /dev/null +++ b/src/amsmathutil25/math/amsmathutil25_vec2i.cpp @@ -0,0 +1,108 @@ +#include + +namespace ams +{ + + vec2i::vec2i() + { + x = 0; + y = 0; + return; + } + + vec2i::vec2i(int _x, int _y) + { + x = _x; y = _y; return; + } + + vec2i::vec2i(const vec2i &rhs) + { + x = rhs.x; + y = rhs.y; + return; + } + + vec2i& vec2i::operator=(const vec2i &rhs) + { + x = rhs.x; + y = rhs.y; + return *this; + } + + bool vec2i::operator==(const vec2i rhs) const + { + return ((this->x == rhs.x) && (this->y == rhs.y)); + } + + // vec2i arithmetic operators + vec2i vec2i::operator+(vec2i rhs) const + { + vec2i ret; + ret.x = this->x + rhs.x; + ret.y = this->y + rhs.y; + return ret; + } + + vec2i vec2i::operator-(vec2i rhs) const + { + vec2i ret; + ret.x = this->x - rhs.x; + ret.y = this->y - rhs.y; + return ret; + } + + vec2i vec2i::operator*(int rhs) const + { + vec2i ret; + ret.x = this->x*rhs; + ret.y = this->y*rhs; + return ret; + } + + vec2i vec2i::operator/(int rhs) const + { + vec2i ret; + ret.x = this->x/rhs; + ret.y = this->y/rhs; + return ret; + } + + vec2i operator-(vec2i rhs) + { + vec2i ret; + ret.x = -rhs.x; + ret.y = -rhs.y; + return ret; + } + + // vec2i subscript operators + int& vec2i::operator[](int ind) + { + if(ind==0) return x; + else if(ind==1) return y; + return x; + } + + const int& vec2i::operator[](int ind) const + { + if(ind==0) return x; + else if(ind==1) return y; + return x; + } + + // vec2i::vec2i(const vec2f &rhs) + // { + // x = (int)rhs.x; + // y = (int)rhs.y; + // return; + // } + + // vec2i::vec2i(const vec2 &rhs) + // { + // x = (int)rhs.x; + // y = (int)rhs.y; + // return; + // } + + +}; diff --git a/src/amsmathutil25/math/amsmathutil25_vec3i.cpp b/src/amsmathutil25/math/amsmathutil25_vec3i.cpp new file mode 100644 index 0000000..8d1dc34 --- /dev/null +++ b/src/amsmathutil25/math/amsmathutil25_vec3i.cpp @@ -0,0 +1,122 @@ +#include + +namespace ams +{ + + vec3i::vec3i() + { + x = 0; + y = 0; + return; + } + + vec3i::vec3i(int _x, int _y, int _z) + { + x = _x; y = _y; z = _z; return; + } + + vec3i::vec3i(const vec3i &rhs) + { + x = rhs.x; + y = rhs.y; + z = rhs.z; + + return; + } + + vec3i& vec3i::operator=(const vec3i &rhs) + { + x = rhs.x; + y = rhs.y; + z = rhs.z; + + return *this; + } + + bool vec3i::operator==(const vec3i rhs) const + { + return ((this->x == rhs.x) && (this->y == rhs.y) && (this->z == rhs.z)); + } + + // vec3i arithmetic operators + vec3i vec3i::operator+(vec3i rhs) const + { + vec3i ret; + ret.x = this->x + rhs.x; + ret.y = this->y + rhs.y; + ret.z = this->z + rhs.z; + return ret; + } + + vec3i vec3i::operator-(vec3i rhs) const + { + vec3i ret; + ret.x = this->x - rhs.x; + ret.y = this->y - rhs.y; + ret.z = this->z - rhs.z; + return ret; + } + + vec3i vec3i::operator*(int rhs) const + { + vec3i ret; + ret.x = this->x*rhs; + ret.y = this->y*rhs; + ret.z = this->z*rhs; + return ret; + } + + vec3i vec3i::operator/(int rhs) const + { + vec3i ret; + ret.x = this->x/rhs; + ret.y = this->y/rhs; + ret.z = this->z/rhs; + return ret; + } + + vec3i operator-(vec3i rhs) + { + vec3i ret; + ret.x = -rhs.x; + ret.y = -rhs.y; + ret.z = -rhs.z; + return ret; + } + + // vec3i subscript operators + int& vec3i::operator[](int ind) + { + if(ind==0) return x; + else if(ind==1) return y; + else if(ind==2) return z; + return x; + } + + const int& vec3i::operator[](int ind) const + { + if(ind==0) return x; + else if(ind==1) return y; + else if(ind==2) return z; + return x; + } + + + // vec3i::vec3i(const vec3f &rhs) + // { + // x = (int)rhs.x; + // y = (int)rhs.y; + // z = (int)rhs.z; + // return; + // } + + // vec3i::vec3i(const vec3 &rhs) + // { + // x = (int)rhs.x; + // y = (int)rhs.y; + // z = (int)rhs.z; + // return; + // } + + +}; diff --git a/src/amsmathutil25/math/amsmathutil25_vec4f.cpp b/src/amsmathutil25/math/amsmathutil25_vec4f.cpp index e0a21d5..30d72fa 100644 --- a/src/amsmathutil25/math/amsmathutil25_vec4f.cpp +++ b/src/amsmathutil25/math/amsmathutil25_vec4f.cpp @@ -612,4 +612,7 @@ mat4f mat4f_transpose(mat4f a) return a.transpose(); } + + + }; \ No newline at end of file diff --git a/src/amsmathutil25/math/amsmathutil25_vec4i.cpp b/src/amsmathutil25/math/amsmathutil25_vec4i.cpp new file mode 100644 index 0000000..f5ac2a4 --- /dev/null +++ b/src/amsmathutil25/math/amsmathutil25_vec4i.cpp @@ -0,0 +1,131 @@ +#include + +namespace ams +{ + + vec4i::vec4i() + { + x = 0; + y = 0; + return; + } + + vec4i::vec4i(int _x, int _y, int _z, int _w) + { + x = _x; y = _y; z = _z; w = _w; return; + } + + vec4i::vec4i(const vec4i &rhs) + { + x = rhs.x; + y = rhs.y; + z = rhs.z; + w = rhs.w; + + return; + } + + vec4i& vec4i::operator=(const vec4i &rhs) + { + x = rhs.x; + y = rhs.y; + z = rhs.z; + w = rhs.w; + + return *this; + } + + bool vec4i::operator==(const vec4i rhs) const + { + return ((this->x == rhs.x) && (this->y == rhs.y) && (this->z == rhs.z) && (this->w == rhs.w)); + } + + // vec4i arithmetic operators + vec4i vec4i::operator+(vec4i rhs) const + { + vec4i ret; + ret.x = this->x + rhs.x; + ret.y = this->y + rhs.y; + ret.z = this->z + rhs.z; + ret.w = this->w + rhs.w; + return ret; + } + + vec4i vec4i::operator-(vec4i rhs) const + { + vec4i ret; + ret.x = this->x - rhs.x; + ret.y = this->y - rhs.y; + ret.z = this->z - rhs.z; + ret.w = this->w - rhs.w; + return ret; + } + + vec4i vec4i::operator*(int rhs) const + { + vec4i ret; + ret.x = this->x*rhs; + ret.y = this->y*rhs; + ret.z = this->z*rhs; + ret.w = this->w*rhs; + return ret; + } + + vec4i vec4i::operator/(int rhs) const + { + vec4i ret; + ret.x = this->x/rhs; + ret.y = this->y/rhs; + ret.z = this->z/rhs; + ret.w = this->w/rhs; + return ret; + } + + vec4i operator-(vec4i rhs) + { + vec4i ret; + ret.x = -rhs.x; + ret.y = -rhs.y; + ret.z = -rhs.z; + ret.w = -rhs.w; + return ret; + } + + // vec4i subscript operators + int& vec4i::operator[](int ind) + { + if(ind==0) return x; + else if(ind==1) return y; + else if(ind==2) return z; + else if(ind==3) return w; + return x; + } + + const int& vec4i::operator[](int ind) const + { + if(ind==0) return x; + else if(ind==1) return y; + else if(ind==2) return z; + else if(ind==3) return w; + return x; + } + + // vec4i::vec4i(const vec4f &rhs) + // { + // x = (int)rhs.x; + // y = (int)rhs.y; + // z = (int)rhs.z; + // w = (int)rhs.w; + // return; + // } + + // vec4i::vec4i(const vec4 &rhs) + // { + // x = (int)rhs.x; + // y = (int)rhs.y; + // z = (int)rhs.z; + // w = (int)rhs.w; + // return; + // } + +}; diff --git a/src/amsmathutil25/math/amsmathutil25_vecconversions.cpp b/src/amsmathutil25/math/amsmathutil25_vecconversions.cpp new file mode 100644 index 0000000..2614dd8 --- /dev/null +++ b/src/amsmathutil25/math/amsmathutil25_vecconversions.cpp @@ -0,0 +1,512 @@ +#include + +namespace ams +{ + + vec2::vec2(const vec3 rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec4 rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec2f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec3f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec4f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec2i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec3i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2::vec2(const vec4i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec2 rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec4 rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec2f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec3f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec4f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec2i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec3i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec3::vec3(const vec4i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec2 rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec3 rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec2f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec3f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec4f rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec2i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec3i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec4::vec4(const vec4i rhs) +{ + x = (double)rhs.x; + y = (double)rhs.y; + return; +} + +vec2f::vec2f(const vec2 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec3 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec4 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec3f rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec4f rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec2i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec3i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2f::vec2f(const vec4i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec2 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec3 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec4 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec2f rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec4f rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec2i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec3i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec3f::vec3f(const vec4i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec2 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec3 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec4 rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec2f rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec3f rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec2i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec3i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec4f::vec4f(const vec4i rhs) +{ + x = (float)rhs.x; + y = (float)rhs.y; + return; +} + +vec2i::vec2i(const vec2 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec3 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec4 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec2f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec3f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec4f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec3i rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec2i::vec2i(const vec4i rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec2 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec3 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec4 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec2f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec3f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec4f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec2i rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec3i::vec3i(const vec4i rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec2 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec3 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec4 rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec2f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec3f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec4f rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec2i rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + +vec4i::vec4i(const vec3i rhs) +{ + x = (int)rhs.x; + y = (int)rhs.y; + return; +} + + + +}; \ No newline at end of file