still plenty of problems with angleaxis and other linear algebra stuff
This commit is contained in:
parent
9bdc13e3fc
commit
5245ceb112
13 changed files with 146 additions and 166 deletions
|
@ -1,29 +1,15 @@
|
|||
add_executable(pwcore_test_matrix
|
||||
pwcore_test_matrix.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(pwcore_test_matrix
|
||||
pwcore)
|
||||
|
||||
add_executable(pwcore_test_vector
|
||||
pwcore_test_vector.cpp
|
||||
macro(make_test arg1)
|
||||
add_executable(${arg1}
|
||||
${arg1}.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(pwcore_test_vector
|
||||
pwcore)
|
||||
target_link_libraries(${arg1}
|
||||
pwcore)
|
||||
endmacro()
|
||||
|
||||
|
||||
add_executable(pwcore_test_quaternion
|
||||
pwcore_test_quaternion.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(pwcore_test_quaternion
|
||||
pwcore)
|
||||
|
||||
|
||||
add_executable(pwcore_test_axisangle
|
||||
pwcore_test_axisangle.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(pwcore_test_axisangle
|
||||
pwcore)
|
||||
make_test(pwcore_test_matrix)
|
||||
make_test(pwcore_test_vector)
|
||||
make_test(pwcore_test_axisangle)
|
||||
make_test(pwcore_test_quaternion)
|
||||
make_test(pwcore_test_transform_tools)
|
||||
make_test(pwcore_test_mesh)
|
||||
|
|
|
@ -8,10 +8,26 @@ int main(int argc,char **argv) {
|
|||
|
||||
pw::axisangle_<float> aa = pw::axisangle_<float>();
|
||||
|
||||
pw::quaternionf qf = pw::quaternionf::from_axisangle(aa);
|
||||
// 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 << "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;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -6,41 +6,35 @@
|
|||
|
||||
int main(int argc,char **argv) {
|
||||
|
||||
// pw::vector2_<float> v2_A = { 3.2, 1.2 };
|
||||
// pw::vector2_<float> v2_B = { 3.2, 1.2 };
|
||||
pw::vector2_<float> v2_A = { 3.2, 1.2 };
|
||||
pw::vector2_<float> v2_B = { 3.2, 1.2 };
|
||||
|
||||
auto AB_lerp = pw::vector2f::lerp(v2_A,v2_B,0.5);
|
||||
|
||||
// auto AB_lerp = pw::vector2f::lerp(v2_A,v2_B,0.5);
|
||||
pw::vector4_<float> v4;
|
||||
pw::vector3f v;
|
||||
|
||||
v4.fill(1.5);
|
||||
|
||||
|
||||
|
||||
// v2 = 0.1f;
|
||||
|
||||
// pw::vector4_<float> v4;
|
||||
// pw::vector3f v;
|
||||
|
||||
// v4.fill(1.5);
|
||||
|
||||
// std::cout << "v4 = " << pw::serialize::matrix(v4) << std::endl;
|
||||
std::cout << "v4 = " << pw::serialize::matrix(v4) << std::endl;
|
||||
|
||||
// std::cout << "rows() : " << v4.rows() << std::endl;
|
||||
// std::cout << "cols() : " << v4.cols() << std::endl;
|
||||
// std::cout << "ptr() : " << v4.ptr() << std::endl;
|
||||
// std::cout << "ptr()[0] : " << v4.ptr()[0] << std::endl;
|
||||
// std::cout << "(0,0) : " << v4(0,0) << std::endl;
|
||||
std::cout << "ptr() : " << v4.ptr() << std::endl;
|
||||
std::cout << "ptr()[0] : " << v4.ptr()[0] << std::endl;
|
||||
std::cout << "(0,0) : " << v4(0,0) << std::endl;
|
||||
|
||||
// auto v3 = v4.xyz();
|
||||
auto v3 = v4.xyz();
|
||||
|
||||
// auto v3_p = v4.project();
|
||||
auto v3_p = v4.project();
|
||||
|
||||
// auto v3_h = v.homogenous();
|
||||
auto v3_h = v.homogenous();
|
||||
|
||||
//// auto v3_lerp = vector4f::lerp()
|
||||
// auto v3_lerp = vector4f::lerp()
|
||||
|
||||
// std::cout << "v3 = " << pw::serialize::matrix(v3) << std::endl;
|
||||
std::cout << "v3 = " << pw::serialize::matrix(v3) << std::endl;
|
||||
|
||||
// std::cout << "v3.normalized() = " << pw::serialize::matrix(v3.normalized()) << std::endl;
|
||||
std::cout << "v3.normalized() = " << pw::serialize::matrix(v3.normalized()) << std::endl;
|
||||
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue