Re: some c functions.

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

On Sun, 21 Mar 1999, Liquid-Nitrogen Software wrote:

] Hi, I've got here some functions from a tutorial on realtime raytracing,
] I'm not sure exactly what the functions do. I guess they're built in to c
] or something. can anyone help me with what they do or how to do it in EU?
]
]
] fsqr(x)
] fabs(z)
] atan2(y, x)

These are all (equivalents to functions) in the math libraries I'm working
on, but I'll resupply direct translations here (in fact these will be
faster than my libraries, since the libraries are sequence generic):

function fabs(atom z)
    if z >= 0 then return z else return -z end if
end function

-- fsqr(x) isn't needed. Use sqrt(x) instead.

function atan2(atom y, atom x)
    if x = 0 then return arctan(1)*2 end if
    return arctan(y/x)
end function

Incidentally, they're built in to math.h IIRC.

HTH,
Carl

--
Carl R White -- cyrek- at -bigfoot.com -- http://www.bigfoot.com/~cyrek
 aka Cyrek   --    No hyphens :)    --       Bigfoot URL Alias

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

Search



Quick Links

User menu

Not signed in.

Misc Menu