#ifndef __QT_ARCBALL__
#define __QT_ARCBALL__

#include <Core/Matrices/MATRIX.h>
#include <Core/Vectors/VECTOR.h>
namespace PhysBAM{

struct QT_ARCBALL
{
    typedef float T;
    typedef VECTOR<T,2> TV2;
    typedef VECTOR<T,3> TV;
    typedef MATRIX<T,3> TM;
    T sphere_radius;
    TV2 center,mouse_down;
    TM rotation_matrix;

    QT_ARCBALL();
    void Update(const TV2 &mouse_now);
    TM Rotation() const {return rotation_matrix;}
    void Begin_Drag(const TV2 &mouse_now);
    void End_Drag();
    TV Mouse_On_Sphere(const TV2 &mouse,const TV2 &ballCenter,T ballRadius) const;
};
}
#endif
