1 Star 1 Fork 0

DGuco/qtproject

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
trackball.h 889 Bytes
一键复制 编辑 原始数据 按行查看 历史
DGuco 提交于 2022-11-09 17:02 +08:00 . 理解代码,添加注释
#ifndef TRACKBALL_H
#define TRACKBALL_H
#include <QtWidgets>
#include <QtGui/qvector3d.h>
#include <QtGui/qquaternion.h>
class TrackBall
{
public:
enum TrackMode
{
Plane,
Sphere,
};
TrackBall(TrackMode mode = Sphere);
TrackBall(float angularVelocity, const QVector3D& axis, TrackMode mode = Sphere);
// coordinates in [-1,1]x[-1,1]
void push(const QPointF& p, const QQuaternion &transformation);
void move(const QPointF& p, const QQuaternion &transformation);
void release(const QPointF& p, const QQuaternion &transformation);
void start(); // starts clock
void stop(); // stops clock
QQuaternion rotation() const;
private:
QQuaternion m_rotation;
QVector3D m_axis;
float m_angularVelocity;
QPointF m_lastPos;
QTime m_lastTime;
bool m_paused;
bool m_pressed;
TrackMode m_mode;
};
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/DGuco/qtproject.git
git@gitee.com:DGuco/qtproject.git
DGuco
qtproject
qtproject
master

搜索帮助