Forums > MaxMSP

Math Help: between two points XYZ

Feb 03 2011 | 5:29 am

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…

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


-- Pasted Max Patch, click to expand. --

Feb 03 2011 | 7:57 pm

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. --

Feb 03 2011 | 11:18 pm

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

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

Feb 04 2011 | 1:30 am

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

Feb 04 2011 | 1:44 am

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

Viewing 5 posts - 1 through 5 (of 5 total)

Forums > MaxMSP