[PD] Gem: trigonometry in 3D space

Martin Dupras martin.dupras at uwe.ac.uk
Fri Jul 11 17:08:39 CEST 2003


Hi,

I'm having a little trouble conceptually with trigonometric concepts in
gem. Any hints of tutorials or examples that could help me with the
following problem would be really useful.

Imagine that I have two spheres, translated in XYZ to random positions
(let's assume (x1,y1,x1) and (x2,y2,z2).

I want to put a cylinder to join the two, and make the cylinder move
with the spheres (in other words, imagine the cylinder is a rubber band
stretched between the two spheres.)

Calculating the length of the cylinder (which I change with scaleXYZ) is
not very difficult, I can obtain it with sqrt (x2 * x1 + y2 * y1 + z2 *
z1).

The tricky part, on the other hand is finding the correct amount of
rotation in xyz for the cylinder, and the correct displacement.

Thanks in advance. 

- martin






More information about the Pd-list mailing list