Commit 38ad98f5 authored by Davis King's avatar Davis King

Fixed some bug in the point rotation code and added more unit tests.

parent 898c948f
......@@ -747,7 +747,7 @@ namespace dlib
matrix<double,3,3> m;
m = ca, 0, sa,
0, 0, 0,
0, 1, 0,
-sa, 0, ca;
vector<double,3> b;
......@@ -767,7 +767,7 @@ namespace dlib
matrix<double,3,3> m;
m = ca, -sa, 0,
sa, ca, 0,
0, 0, 0;
0, 0, 1;
vector<double,3> b;
......
......@@ -812,17 +812,27 @@ namespace
const dlib::vector<double> x(1,0,0);
const dlib::vector<double> y(0,1,0);
const dlib::vector<double> z(0,0,1);
const dlib::vector<double> e(1,1,1);
const dlib::vector<double> ex(-1,1,1);
const dlib::vector<double> ey(1,-1,1);
const dlib::vector<double> ez(1,1,-1);
dlib::vector<double> w;
w = rotate_around_z(pi/2)(x);
DLIB_TEST(length(w-y) < 1e-12);
w = rotate_around_z(pi/2)(e);
DLIB_TEST(length(w-ex) < 1e-12);
w = rotate_around_y(-pi/2)(x);
DLIB_TEST(length(w-z) < 1e-12);
w = rotate_around_y(pi/2)(e);
DLIB_TEST(length(w-ez) < 1e-12);
w = rotate_around_x(pi/2)(y);
DLIB_TEST(length(w-z) < 1e-12);
w = rotate_around_x(pi/2)(e);
DLIB_TEST(length(w-ey) < 1e-12);
w = translate_point(x)(y);
DLIB_TEST(length(w-x-y) < 1e-12);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment