Shop OBEX P1 Docs P2 Docs Learn Events
Any chance? — Parallax Forums

Any chance?

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

Comments

  • Heater.Heater. Posts: 21,230
    You mean quaternions?

    Oh boy!
  • rjo__rjo__ Posts: 2,114
    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:)
  • ElectrodudeElectrodude Posts: 1,657
    edited 2015-12-11 21:47
    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.
  • rjo__rjo__ Posts: 2,114
    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.
  • 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
    
  • Heater.Heater. Posts: 21,230
    rjo__

    But, but, there are only imaginary numbers :)
  • rjo__rjo__ Posts: 2,114
    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.
  • rjo__rjo__ Posts: 2,114
    the tinker toy is Processing 3... simplest thing is a total nightmare.
  • rjo__rjo__ Posts: 2,114
    Solved it... had the call in the wrong place.

    687 x 631 - 43K
  • rjo__rjo__ Posts: 2,114
    That's what the raw data looks like... next I'm going to have the P2 to clean it up a little:)
Sign In or Register to comment.