1. Re: 3D distance
- Posted by =?ISO-8859-2?Q?Tom_=A9upka?= <TomSupka at BIGFOOT.COM> Sep 19, 1998
- 431 views
- Last edited Sep 20, 1998
Hi, >-- original function >function perspective (sequence thing, sequence eye) > sequence t, i > atom r > r =3D thing [Z] / (thing [Z] - eye [Z]) -- Notice this line**** > t=3Dthing[X..Y] i=3Deye[X..Y] > return (t + r * (i - t)) >end function I don't know what this function is for (it looks like 3D point = perspective projection to 2D point but it ain't) but if you think r is a = distance I give you the formula (don't you remember Pythagoras?): d =3D sqrt( sqr(dx) + sqr(dy) + sqr(dz) ) and in Euphoria: function distance3D( sequence p1, sequence p2 ) sequence d d =3D p1 - p2 d =3D d*d return sqrt(d[X]+d[Y]+d[Z]) end function (I didn't test it) Tom