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

#include <iostream>

int main(int argc,char **argv) {

    pw::axisangle_<float> aa = pw::axisangle_<float>();

//	pw::quaternionf qf = pw::quaternionf::from_axisangle(aa);
//	std::cout << "aa as quaternion as matrix = " << pw::serialize::matrix(qf.to_matrix()) << std::endl;
//	std::cout << "aa.matrix() = " << pw::serialize::matrix(qf.to_matrix()) << std::endl;

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

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

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

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

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

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



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

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

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


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

	pw::matrix4x4f mrot; mrot.zero();
	mrot(0,0) = 1;
	mrot(2,1) = 1;
	mrot(1,2) = -1;

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

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



    return 0;
}
