Math Help: jit.gl.gridshape between two points XYZ

Feb 3, 2011 at 5:29am

Math Help: jit.gl.gridshape between two points XYZ

Hi all,

I am drawing a blank… literally…

Given two XYZ points (say left sphere and right sphere), how can I draw a cube between them?

It seems I would need to get the center point (in XYZ) first…
Then be able to know the size/distance between the two points (I think I can get that thanks to MRdistance)

any and all help is welcome… I promise to share the kinect fun with this if this is possible…

thanks!
tohm
here is starting point I got to (without my disaster trials)

`

– Pasted Max Patch, click to expand. –
#54765
Feb 3, 2011 at 7:57pm

This should help a bit — got rid of the mesh (you don’t need it) and sent loadbang to the positions of the two spheres.

– Pasted Max Patch, click to expand. –
#197170
Feb 3, 2011 at 11:18pm

thanks, it was a quick and dirty mock up….

any help on the math? I still can’t find anything…

#197171
Feb 4, 2011 at 1:30am

Add the respective position values of the spheres together and divide by 2?

( xSphere1 + xSphere2 ) / 2. = xCube
( ySphere1 + ySphere2 ) / 2. = yCube
( zSphere1 + zSphere2 ) / 2. = zCube

#197172
Feb 4, 2011 at 1:44am

I just had the same idea… and it works! Good things coming… my plan is to use the Kinect to move “boxes” of samples around a room… I already have the selection and effects built for 3d, now I just need to tweak…

Thanks for your help

#197173

You must be logged in to reply to this topic.