#include <pw/core/axisangle.hpp>
#include <pw/core/serialize.hpp>

#include <iostream>

auto main() -> int {

    auto aa = pw::axisangle<float>();

    std::cout << "x-axis" << std::endl;

    aa.axis  = pw::vector3f::x_axis();
    aa.angle = pw::deg_to_rad(45.f);

    std::cout << "aa.matrix() = " << std::endl
              << pw::serialize::to_string(aa.to_matrix()) << std::endl;
    std::cout << "y-axis" << std::endl;

    aa.axis  = pw::vector3f::y_axis();
    aa.angle = pw::deg_to_rad(45.f);

    std::cout << "aa.matrix() = " << std::endl
              << pw::serialize::to_string(aa.to_matrix()) << std::endl;

    std::cout << "z-axis" << std::endl;

    aa.axis  = pw::vector3f::z_axis();
    aa.angle = pw::deg_to_rad(45.f);

    std::cout << "aa.matrix() = " << std::endl
              << pw::serialize::to_string(aa.to_matrix()) << std::endl;

    std::cout << "from matrix" << std::endl;

    auto mrot  = pw::matrix<float, 4, 4>{};
    mrot[0][0] = 1;
    mrot[2][1] = 1;
    mrot[1][2] = -1;

    auto aa_fm = pw::axisanglef::from_matrix(mrot);

    std::cout << pw::serialize::to_string(aa_fm.axis) << " "
              << pw::rad_to_deg(aa_fm.angle) << "deg" << std::endl;

    return 0;
}
