Distance and Angles in Multiple Dimensions

new topic     » topic index » view thread      » older message » newer message

First of all, although this thread started with a question of Patrat, I wont
think he's very interested in 4th and 5th dimensions. So this if for fun,
and not practicle reasons. Nevertheless, why not have a look at Micheal
Sibal's code, since he mentioned it. (thanx)

However, for theory and fun, its nice to speculate on these things.
Hawke, said the theory only works for right triangles, but consider a
one-dimensional surrounding:

It would be length^2 = length^2 + nothing^2
Hmm, it would say both sides are of equal length.. woops.. heh! Thats true!
Pythagoras was way above triangles it seems blink

Plus no angle is undefined. We are comparing two directions, of which one is
blindly chosen. (angle 0)
An angle of 180 degrees. Will have one of the two values as a zero. (since
the horizontal difference is nothing)

I would say, this is the ending function:
Anyone (theoretically) disagrees, since we cant test it in practise ?

function relat (object a, object b)
sequence angles
atom dist

    if atom (a) and atom(b) then
        if a >= b then
            return { a-b, 0}
        else
            return { b-a, 1.5708}
            -- Any1 wants to replace 1.5708 with something more precize ?
        end if
    end if
    a = a - b
    b = a * a
    a = a + (a = 0) * 0.000000000000000001    -- Precize enough ?
    angles = {arctan(a[1]/a[2])}
    dist = b[1]
    for index = 2 to length(a) do
        dist = dist + b[index]
        angles = append(angles, arctan(sqrt(dist), b[index])
    end for
    return prepend(angles, sqrt(dist))
end function

-- We might need to 'round' the result a little.

Ralf

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu