still not there yet
This commit is contained in:
parent
b2172d88fb
commit
830b63cf88
13 changed files with 369 additions and 356 deletions
|
@ -5,25 +5,25 @@ add_executable(pwcore_test_matrix
|
|||
target_link_libraries(pwcore_test_matrix
|
||||
pwcore)
|
||||
|
||||
add_executable(pwcore_test_vector
|
||||
pwcore_test_vector.cpp
|
||||
)
|
||||
#add_executable(pwcore_test_vector
|
||||
# pwcore_test_vector.cpp
|
||||
# )
|
||||
|
||||
target_link_libraries(pwcore_test_vector
|
||||
pwcore)
|
||||
#target_link_libraries(pwcore_test_vector
|
||||
# pwcore)
|
||||
|
||||
|
||||
add_executable(pwcore_test_quaternion
|
||||
pwcore_test_quaternion.cpp
|
||||
)
|
||||
#add_executable(pwcore_test_quaternion
|
||||
# pwcore_test_quaternion.cpp
|
||||
# )
|
||||
|
||||
target_link_libraries(pwcore_test_quaternion
|
||||
pwcore)
|
||||
#target_link_libraries(pwcore_test_quaternion
|
||||
# pwcore)
|
||||
|
||||
|
||||
add_executable(pwcore_test_axisangle
|
||||
pwcore_test_axisangle.cpp
|
||||
)
|
||||
#add_executable(pwcore_test_axisangle
|
||||
# pwcore_test_axisangle.cpp
|
||||
# )
|
||||
|
||||
target_link_libraries(pwcore_test_axisangle
|
||||
pwcore)
|
||||
#target_link_libraries(pwcore_test_axisangle
|
||||
# pwcore)
|
||||
|
|
|
@ -8,11 +8,10 @@ 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 vector = " << pw::serialize::matrix(qf.as_vector()) << std::endl;
|
||||
|
||||
// std::cout << "aa.matrix() = " << pw::serialize::matrix(qf.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;
|
||||
|
|
|
@ -2,27 +2,13 @@
|
|||
|
||||
#include <pw/core/matrix.hpp>
|
||||
#include <pw/core/vector.hpp>
|
||||
|
||||
//#include <pw/core/serialize.hpp>
|
||||
#include <pw/core/serialize.hpp>
|
||||
|
||||
#include <pw/core/debug.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
template <typename T_,typename O_,size_t R,size_t C> inline static
|
||||
std::basic_ostream<O_>& operator << (std::basic_ostream<O_>& os,
|
||||
const pw::matrix_<T_,R,C>& m
|
||||
)
|
||||
{
|
||||
for (size_t r = 0; r < R;r++){
|
||||
for (size_t c = 0;c < C;c++) {
|
||||
os << m(r,c) << " ";
|
||||
}
|
||||
os << std::endl;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
int main(int argc,char **argv) {
|
||||
|
||||
|
@ -39,36 +25,39 @@ int main(int argc,char **argv) {
|
|||
|
||||
vector2f v3( { 1.f,2.f } );
|
||||
|
||||
|
||||
auto m22_inv = m22.inverse();
|
||||
auto m22_id = m22_inv * m22;
|
||||
|
||||
|
||||
auto v2_t = m22_id * v2;
|
||||
auto v3_t = m22_id * v3;
|
||||
|
||||
|
||||
|
||||
auto v2_f = m22 * v2;
|
||||
auto v2_b = m22_inv * v2_f;
|
||||
|
||||
|
||||
vector2f r_m22 = m22.row(0);
|
||||
|
||||
debug::d() << "offset(0,1) col-major " << m22.offset(0,1);
|
||||
debug::d() << "det " << m22.determinant();
|
||||
|
||||
std::cout << "m22 " << m22 << std::endl;
|
||||
std::cout << "m22-1 " << m22_inv << std::endl;
|
||||
std::cout << "m22-i " << m22_id << std::endl;
|
||||
std::cout << "v22_t " << v2_t << std::endl;
|
||||
std::cout << "v3_t " << v3_t << std::endl;
|
||||
std::cout << "m22 " << pw::serialize::matrix(m22) << std::endl;
|
||||
std::cout << "m22-1 " << pw::serialize::matrix(m22_inv) << std::endl;
|
||||
std::cout << "m22-i " << pw::serialize::matrix(m22_id) << std::endl;
|
||||
std::cout << "v22_t " << pw::serialize::matrix(v2_t) << std::endl;
|
||||
std::cout << "v3_t " << pw::serialize::matrix(v3_t) << std::endl;
|
||||
|
||||
std::cout << "v2_f " << v2_f << std::endl;
|
||||
std::cout << "v2_b " << v2_b << std::endl;
|
||||
|
||||
std::cout << "v2_f " << pw::serialize::matrix(v2_f) << std::endl;
|
||||
std::cout << "v2_b " << pw::serialize::matrix(v2_b) << std::endl;
|
||||
|
||||
std::cout << "v2_b.norm " << v2_b.norm() << std::endl;
|
||||
|
||||
// v2_b.normalize();
|
||||
std::cout << "v2_b.normalized " << v2_b.normalized() << std::endl;
|
||||
std::cout << "v2_b.normalized " << pw::serialize::matrix(v2_b.normalized()) << std::endl;
|
||||
|
||||
std::cout << "v2_b~v3_t " << rad_to_deg(vector2f::angle_between(v2,v3)) << std::endl;
|
||||
// std::cout << "v2_b~v3_t " << rad_to_deg(vector2f::angle_between(v2,v3)) << std::endl;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -20,10 +20,8 @@ int main(int argc,char **argv) {
|
|||
pw::quaternionf qi = qf.inverse();
|
||||
std::cout << "qf.inverse() (qi) = " << pw::serialize::matrix(qi) << std::endl;
|
||||
|
||||
// pw::quaternionf qmid = pw::quaternionf::normalized_lerp(qi,qf,0.5f);
|
||||
|
||||
// std::cout << "qmid.dot() (half between qf and qi) = " << pw::rad_to_deg(std::acos(qmid.dot(qf))) << std::endl;
|
||||
|
||||
pw::quaternionf qmid = pw::quaternionf::normalized_lerp(qi,qf,0.5f);
|
||||
// std::cout << "qmid.dot() (half between qf and qi) = " << pw::rad_to_deg(quaternionf::angle_between()) << std::endl;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,30 +6,34 @@
|
|||
|
||||
int main(int argc,char **argv) {
|
||||
|
||||
pw::vector4_<float> v4;
|
||||
pw::vector3f v;
|
||||
pw::vector2_<float> v2;
|
||||
|
||||
v4.fill(1.5);
|
||||
v2.x = 0.1f;
|
||||
|
||||
std::cout << "v4 = " << pw::serialize::matrix(v4) << std::endl;
|
||||
// pw::vector4_<float> v4;
|
||||
// pw::vector3f v;
|
||||
|
||||
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;
|
||||
// v4.fill(1.5);
|
||||
|
||||
auto v3 = v4.xyz();
|
||||
// std::cout << "v4 = " << pw::serialize::matrix(v4) << std::endl;
|
||||
|
||||
auto v3_p = v4.project();
|
||||
// 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;
|
||||
|
||||
auto v3_h = v.homogenous();
|
||||
// auto v3 = v4.xyz();
|
||||
|
||||
// auto v3_lerp = vector4f::lerp()
|
||||
// auto v3_p = v4.project();
|
||||
|
||||
std::cout << "v3 = " << pw::serialize::matrix(v3) << std::endl;
|
||||
// auto v3_h = v.homogenous();
|
||||
|
||||
std::cout << "v3.normalized() = " << pw::serialize::matrix(v3.normalized()) << std::endl;
|
||||
//// auto v3_lerp = vector4f::lerp()
|
||||
|
||||
// std::cout << "v3 = " << pw::serialize::matrix(v3) << 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