OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Converting an osg::Matrix to osg::PositionAttitudeTransform using decompose?


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Waaayoff
Newbie


Joined: 16 Jul 2018
Posts: 8

PostPosted: Fri Jan 18, 2019 3:34 pm    Post subject:
Converting an osg::Matrix to osg::PositionAttitudeTransform using decompose?
Reply with quote

I have a matrix that is constructed as follows:

Code:
osg::Matrix final;
final.preMultScale(inverseParentScale);
final.preMultRotate((worldRotation * inverseWorld).getRotate());
final.preMultScale(parentScale);


What I'm basically trying to do is rotate a child by first calculating a world rotation and then converting it to a local rotation by multiplying by the inverse world transform. The problem is that if the parent is non-uniformly scaled, the result is weirdly sheared. So I thought I would remove the parent scale, rotate, then apply the parent scale back, which is what I think the above lines do, but please feel free to correct me.

Now what I want is to convert the result to a PositionAttitudeTransform. But I'm not getting correct results doing the following:

Code:
osg::Vec3d t, s;
osg::Quat r, so;
final.decompose(t, r, s, so);
_childTransform->setScale(s);
_childTransform->setAttitude(r);


I suspect that the "scale factor" parameter is the issue, since it has non-zero values and Im not using them, but I'm not sure what it even is.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts [Help] OSG + ArKit: Problem convertin... Brayner General 4 Mon Oct 08, 2018 7:07 pm View latest post
No new posts Absolute final world position matrix ... Steal General 1 Mon Sep 24, 2018 11:25 am View latest post
No new posts Model matrix kullboys General 0 Tue Aug 21, 2018 7:10 am View latest post
No new posts Converting PrimitiveSet to use triang... Waaayoff General 7 Fri Jul 27, 2018 12:06 pm View latest post
No new posts Stuck with applying an offset to proj... wernerM General 5 Mon Jun 25, 2018 10:11 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP