13 using namespace Eigen;
20 bool newPointOk = mapToSphere(point2D, newPoint3D);
22 if (mLastPointOk && newPointOk)
24 Vector3f axis = mLastPoint3D.cross(newPoint3D).normalized();
25 float cos_angle = mLastPoint3D.dot(newPoint3D);
28 float angle = 2. *
acos(cos_angle);
36 mLastPoint3D = newPoint3D;
37 mLastPointOk = newPointOk;
42 if ((p2.x() >= 0) && (p2.x() <=
int(mpCamera->vpWidth())) &&
43 (p2.y() >= 0) && (p2.y() <=
int(mpCamera->vpHeight())) )
45 double x = (double)(p2.x() - 0.5*mpCamera->vpWidth()) / (
double)mpCamera->vpWidth();
46 double y = (double)(0.5*mpCamera->vpHeight() - p2.y()) / (
double)mpCamera->vpHeight();
47 double sinx =
sin(
M_PI * x * 0.5);
48 double siny =
sin(
M_PI * y * 0.5);
49 double sinx2siny2 = sinx * sinx + siny * siny;
53 v3.z() = sinx2siny2 < 1.0 ?
sqrt(1.0 - sinx2siny2) : 0.0;
Jet< T, N > acos(const Jet< T, N > &f)
Jet< T, N > sin(const Jet< T, N > &f)
Namespace containing all symbols from the Eigen library.
AngleAxis< float > AngleAxisf
void track(const Eigen::Vector2i &newPoint2D)
bool mapToSphere(const Eigen::Vector2i &p2, Eigen::Vector3f &v3)
Jet< T, N > sqrt(const Jet< T, N > &f)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Quaternion< float > Quaternionf