Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 16:33 14 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2 Maths Issue (MATH Q_ROTATE)

Author Message
x4nd
Newbie

Joined: 05/07/2020
Location: United Kingdom
Posts: 11
Posted: 06:37pm 24 Aug 2020
Copy link to clipboard 
Print this post

Hi All,

I guess this is a question for Peter Mather, given he's the "Maths Wiz"?

I have been exploring the rotating ball Icosahedron demo program.  Making it do different things, run faster, etc.  I decided to try to port it to the new maths functions, "MATH Q_ROTATE" being the main one for the main loop of the rotating ball.  It looks like it should be a drop-in replacement for the existing "rotate_vector" function, but I'm getting very odd results which then made me think that I didn't understand the quaternions at all.

So, does this function work properly?  If you do take that program and exchange the interpreted function for the built-in version does it work?  Been scratching my head about this for quite a few hours.  I don't seem to be able to get results that mean anything sensible.

Anyhow, I'm loving the CMM2 so far - it's beyond my expectations and really fun to play with.

-Stuart
If only there were more hours in the day..
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10580
Posted: 06:41pm 24 Aug 2020
Copy link to clipboard 
Print this post

The order of the parameters in the q array are different as they were a bit illogical in the Basic version. If you get these right then it will work. I did update the rotating ball to the MATH versions and got about a 25% speed improvement. Much of the time is taken in the plotting. Unfortunately I then overwrote the updated version so I can't post it.
 
x4nd
Newbie

Joined: 05/07/2020
Location: United Kingdom
Posts: 11
Posted: 06:57pm 24 Aug 2020
Copy link to clipboard 
Print this post

No problem.  I got the interpreted version up to 30fps and would like more speed!  I'll have another look at the ordering of the quaternions.  

I assume it should be w-x-y-z-mag.  I think the interpreted version is mag-w-x-y-z?

Anyhoo - more playing.

Thanks for your time.
If only there were more hours in the day..
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025