Re: Distance and Angles in Multiple Dimensions

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

I stand completely corrected, Hawke.
For me the word speculate is pretty much how I made the function.
And indeed a lot of brainfarts. Oh well, Im not accurate enough for match.
Im used to Euphoria telling me I did something wrong, and what Im doing
wrong. Esspecially during math tests, I need to remember, that my result
isnt a prototype or something, oh well, we figured it out now, havent' we ?
Ive removed the '>' and stuff, so people can easily cut & paste, if they
ever wanne make some science fiction game blink

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}   -- angles start at zero, end of
discussion blink
                    else return {b-a,PI}
        end if
    end if
    a = a - b
    -- Not the fastest approuch though:
    a = a * ((a < 0 * -1) + (a > 0))
    b = a * a
    -- Jiri or any other math magician wanne help out here ?
    -- This will work, but if any one has a more idealistic approuch to
handle the
    -- division by zero thingie ?
    -- Or do I need to look this up in some old math book ?
    a = a + (a = 0) * 0.000000000000000001
    angles={arctan(a[2]/a[1])}
    dist = b[1]
    for index = 2 to length(a) do
         dist = dist + b[index]
        angles=append(angles,arctan(a[index],sqrt(dist)))
    end for
    return {sqrt(dist),angles}
end function

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

Search



Quick Links

User menu

Not signed in.

Misc Menu