this is basically a design document version - it sets the scenery for upcoming additions
This commit is contained in:
parent
32aac45162
commit
550d27273f
1504 changed files with 1051518 additions and 127 deletions
29
src/core/tests/CMakeLists.txt
Normal file
29
src/core/tests/CMakeLists.txt
Normal file
|
@ -0,0 +1,29 @@
|
|||
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
|
||||
)
|
||||
|
||||
target_link_libraries(pwcore_test_vector
|
||||
pwcore)
|
||||
|
||||
|
||||
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)
|
19
src/core/tests/pwcore_test_axisangle.cpp
Normal file
19
src/core/tests/pwcore_test_axisangle.cpp
Normal file
|
@ -0,0 +1,19 @@
|
|||
#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 vector = " << pw::serialize::matrix(qf.as_vector()) << std::endl;
|
||||
|
||||
// std::cout << "aa.matrix() = " << pw::serialize::matrix(qf.to_matrix()) << std::endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
38
src/core/tests/pwcore_test_matrix.cpp
Normal file
38
src/core/tests/pwcore_test_matrix.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
|
||||
#include <pw/core/matrix.hpp>
|
||||
#include <pw/core/serialize.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc,char **argv) {
|
||||
|
||||
pw::matrix44d m;
|
||||
|
||||
m.set_identity();
|
||||
|
||||
std::cout << "m = " << pw::serialize::matrix(m) << std::endl;
|
||||
|
||||
|
||||
std::cout << "row_stride() : " << m.row_stride() << std::endl;
|
||||
std::cout << "col_stride() : " << m.col_stride() << std::endl;
|
||||
std::cout << "rows() : " << m.rows() << std::endl;
|
||||
std::cout << "cols() : " << m.cols() << std::endl;
|
||||
std::cout << "data() : " << m.data() << std::endl;
|
||||
std::cout << "data()[0] : " << m.data()[0] << std::endl;
|
||||
std::cout << "at(0,0) : " << m.at(0,0) << std::endl;
|
||||
std::cout << "determinant(): " << m.determinant() << std::endl;
|
||||
|
||||
|
||||
pw::matrix44d mi = m.get_inverse();
|
||||
|
||||
std::cout << "mi.at(0,0) : " << mi.at(0,0) << std::endl;
|
||||
|
||||
|
||||
pw::matrix44d mscale = m * 4.2;
|
||||
|
||||
|
||||
std::cout << "mscale = " << pw::serialize::matrix(mscale) << std::endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
15
src/core/tests/pwcore_test_quaternion.cpp
Normal file
15
src/core/tests/pwcore_test_quaternion.cpp
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include <pw/core/quaternion.hpp>
|
||||
#include <pw/core/serialize.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc,char **argv) {
|
||||
|
||||
pw::quaternion<float> qf = pw::quaternionf::rotate_180_degree_around_x();
|
||||
|
||||
std::cout << "qf = " << pw::serialize::matrix(qf.as_vector()) << std::endl;
|
||||
std::cout << "qf.matrix() = " << pw::serialize::matrix(qf.to_matrix()) << std::endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
29
src/core/tests/pwcore_test_vector.cpp
Normal file
29
src/core/tests/pwcore_test_vector.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
|
||||
#include <pw/core/vector.hpp>
|
||||
#include <pw/core/serialize.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc,char **argv) {
|
||||
|
||||
pw::vector4<float> v4;
|
||||
|
||||
v4.fill(1.5);
|
||||
|
||||
std::cout << "v4 = " << pw::serialize::matrix(v4) << std::endl;
|
||||
|
||||
std::cout << "row_stride() : " << v4.row_stride() << std::endl;
|
||||
std::cout << "col_stride() : " << v4.col_stride() << std::endl;
|
||||
std::cout << "rows() : " << v4.rows() << std::endl;
|
||||
std::cout << "cols() : " << v4.cols() << std::endl;
|
||||
std::cout << "data() : " << v4.data() << std::endl;
|
||||
std::cout << "data()[0] : " << v4.data()[0] << std::endl;
|
||||
std::cout << "at(0,0) : " << v4.at(0,0) << std::endl;
|
||||
|
||||
pw::vector3f v3 = v4.xyz();
|
||||
|
||||
std::cout << "v3 = " << pw::serialize::matrix(v3) << std::endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue