3d cartesian to polar problem

jeremybailey's icon

Hello world,

I'm trying to figure out how to get a shape to orient itself (angle) according to the placement of 2 points in 3d space. I've got it working mostly, but for some reason it falls apart when the z value is between -1.0 and 1.0

This is a useful operation to orient "bones" between joints in a 3d skeleton provided by OSCeleton (kinect)

Max Patch
Copy patch and select New From Clipboard in Max.

please see below, any help would be greatly appreciated (fail case image attached)

2544.Screenshot20110817at9.04.42PM.png
png
Floating Point's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I thought it might be a message order or calculation order problem so I cleaned up your patch for you, but the problem is still there... I suspect it's a 3d spatial calculation issue, which i know nothing about...
but anyway, the clean-up has made the patch a lot more efficient, and the message order is now explicit, using the trigger object-- also note use of vexpr
EDIT: reposted patch (forgot to delete a redundant object)

jeremybailey's icon

Thanks terry! that is indeed cleaner,
it was messy so I could get "dirty" flipping coordinates and angles if I needed to... I think it's because these calculations rely on a degree of freedom less than 180... 3D math definitely isn't my forté either!

anyway, thanks again for your help!

jeremy

giolivio's icon

Hi Folks!
I'm also playing around with Kinect and Synapse having big problems to orient 3D bones..
Any solution?
Thanks,
Giorgio

sterlingcrispin@gmail.com's icon

hey giolivo

try this

this isn't the whole answer but its part of it, dig around on some math & other 3d graphics forums the answers are out there

/edit missed that this was from a a month ago & a year ago, nevermind! maybe someone will run into this and find it useful