Welcome to the Parallax Discussion Forums, sign-up to participate.

Any chance?

Posts: 2,087
of making the cordic do 3d rotations? I am willing to add water cooling:)

• Posts: 21,233
You mean quaternions?

Oh boy!
• Posts: 2,087
I don't believe in quaternions... anything that uses imaginary numbers can be done better in some other way... there you go Chip... a challenge!!!

btw: My head has a gimbal lock and it didn't keep me from flying a Cessna If I could have understood what the controllers were saying, I probably wouldn't have quit:)
• Posts: 1,436
edited 2015-12-11 - 21:47:35
Couldn't you just do QROT three times in a row?
```setq    y
qrotate x, zr
getqx   x
getqy   y

setq    x
qrotate z, yr
getqx   z
getqy   x

setq    z
qrotate y, xr
getqx   y
getqy   z
```

My order of transformations is likely wrong, but you get the point.

Of course, if you wanted to do this a lot for the same values of xr, yr, and zr, you'd probably be better off with 3x3 matrix multiplication, doing the trig only when xr, yr, and zr change.
• Posts: 2,087
Yes, but you just filled up the cordic.. That means one point at a time. Of course adding 3D might also slow it down for 2D... so it might be one of those
things that sounds good, but isn't really all that good.
• Posts: 1,436
You could interleave three at a time:
```setq    y1
qrotate x1, zr1
setq    y2
qrotate x2, zr2
setq    y3
qrotate x3, zr3

getqx   x1
getqy   y1
getqx   x2
getqy   y2
getqx   x3
getqy   y3

setq    x1
qrotate z1, yr1
setq    x2
qrotate z2, yr2
setq    x3
qrotate z3, yr3

getqx   z1
getqy   x1
getqx   z2
getqy   x2
getqx   z3
getqy   x3

setq    z1
qrotate y1, xr1
setq    z2
qrotate y2, xr2
setq    z3
qrotate y3, xr3

getqx   y1
getqy   z1
getqx   y2
getqy   z2
getqx   y3
getqy   z3
```
• Posts: 21,233
rjo__

But, but, there are only imaginary numbers
• Posts: 2,087
sometimes I wish I had 16 fingers... just spent 7 hours trying to get a file saved using that tinker toy we were talking about.
• Posts: 2,087
the tinker toy is Processing 3... simplest thing is a total nightmare.
• Posts: 2,087
Solved it... had the call in the wrong place.

• Posts: 2,087
That's what the raw data looks like... next I'm going to have the P2 to clean it up a little:)