osg的四元数连乘

实验中,xquat是竖直的那个,yquat是与屏幕平行的那个,zquat是水平的那个。如果是vec2 = quatxquatyquatZ*vec1,则先转xquat,再转yquat,再转zquat,
问题来了,如果多个步骤,该怎么办?顺序的不同,会导致结果的不同
那就设定一个数组,

struct DataRange : public osg::Referenced
{
//四元数数组
std::vectorosg::Quat _quatVector = std::vectorosg::Quat();
//六个面的法线
std::vectorosg::Vec3d _normalVector = std::vectorosg::Vec3d();
//中心点初始坐标(可能没在原点上)
osg::Vec3d _center;
//当前旋转的dir,也就是哪个dragger在起作用
RotateCutDirection _dir = None;
};

在release时,把该四元数加入到数组中

bool MyRotateCylinderDragger::handle(
const osgManipulator::PointerInfo& pointer,
const osgGA::GUIEventAdapter& ea,
osgGA::GUIActionAdapter& aa)
{
// Check if the dragger node is in the nodepath.
if (!pointer.contains(this)) return false;

switch (ea.getEventType())
{
	// Pick start.
case (osgGA::GUIEventAdapter::PUSH):
{
	_bRelease = false;
	_dataRange->_dir = _dir;
	// Get the LocalToWorld matrix for this node and set it for the projector.
	osg::NodePath nodePathToRoot;
	computeNodePathToRoot(*this, nodePathToRoot);
	osg::Matrix localToWorld = osg::computeLocalToWorld(nodePathToRoot);
	_projector->setLocalToWor
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值