1. Math question

Hello,
I need to know what the cordinates X,Y are giving that the are P
pixels away and D  Degrees clockwise from N,I.
Thanks :).
--PatRat (Thomas Parslow)
--               ()___()
--                (o o)
--                =\O/=
--             Rat Software
-- http://www3.mistral.co.uk/billparsl/

new topic     » topic index » view message » categorize

2. Re: Math question

PatRat wrote:
> Hello,
> I need to know what the cordinates X,Y are giving that the are P
> pixels away and D  Degrees clockwise from N,I.
> Thanks :).

-- first let's convert D to radians with the function

constant        pi = 3.141592653589

function deg2rad(atom d)
        return d / 180 * pi
end function

-- wewp wewp okay now i'm assuming that 0 degrees (or radians now)
means   -- it's to the right, and pi / 2 would be up, pi would be left,
etc.

function where_coords(atom P, atom D)
        D = deg2rad(D)          -- unless you've already done this
        y = -P * sin(D)         -- negative becos in gfx, -y is up
                                -- whereas in trig, -y is down :\
        x = p * cos(D)
end function

-- w00p it's been quite a while since i've taken math...i guess trig
sticks
        -- to ya...i wonder if that's a good thing :\

--

Mike Burrell
http://mikpos.home.ml.org/
mikpos at softhome.net

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu