/// Josh's 3D Math Library /// A C++20 Library for 3D Math, Computer Graphics, and Scientific Computing. /// Developed and Maintained by Josh O'Leary @ Redacted Software. /// Special Thanks to William Tomasine II and Maxine Hayes. /// (c) 2024 Redacted Software /// This work is dedicated to the public domain. /// @file main.cpp /// @desc Demonstrates J3ML features. /// @edit 2024-07-06 #include #include #include #include #include #include #include #include "J3ML/Rotation.hpp" int main(int argc, char** argv) { Matrix3x3 matrix_rep = { 0.9902160, 0.0000000, 0.1395431, 0.1273699, 0.4084874, -0.9038334, -0.0570016, 0.9127640, 0.4044908}; Quaternion quat_rep = {0.5425029, 0.0586955, 0.0380374, 0.8371371}; AxisAngle aa_rep = { {0.9917912, 0.1073057, 0.069539}, 1.1575362}; using namespace J3ML::Math; // Test quadrant for (float r = 0; r < TwoPi; r+=0.25f) { Quadrant q = QuadrantOf(r); if (q == Quadrant::I) std::cout << "I" << std::endl; if (q == Quadrant::II) std::cout << "II" << std::endl; if (q == Quadrant::III) std::cout << "III" << std::endl; if (q == Quadrant::IV) std::cout << "IV" << std::endl; } for (int i = 10; i < 9999999; i*=1.5f) { std::cout << J3ML::Math::Functions::Truncate(i) << std::endl; } Ray a({420, 0, 0}, {1, 0, 0}); std::cout << a << std::endl; Matrix4x4 A { 1, 2, 0, 1, 3, 1, 2, 0, 0, 4, 1, 2, 2, 0, 3, 1 }; Matrix4x4 B { 0, 1, 2, 3, 1, 0, 1, 0, 2, 3, 0, 1, 1, 2, 1, 0 }; auto C = A*B; using Matrix2x3f = Matrix<2, 3, float>; std::cout << C << std::endl; std::cout << "j3ml demo coming soon" << std::endl; v2f _v2f{1.f}; v3f _v3f{1.f}; v4f _v4f(1); v2i ipair (420, 420); v3i ipair3(0,0,0); v4i ipair4(1,2,3,4); using namespace J3ML::Math; Rotation my_rot = 25_degrees; return 0; } #ifdef __WIN32 extern "C" { int wmain(int argc, wchar_t* argv[]) { return main(argc, reinterpret_cast(argv)); } }; #endif