Re: openGL problem

From: Dances With Crows (danSPANceswitTRAPhcrows_at_gmail.com)
Date: 06/27/05


Date: Mon, 27 Jun 2005 11:45:35 -0500

On Mon, 27 Jun 2005 05:39:24 GMT, Richard Harke staggered into the Black
Sun and said:
> Dances With Crows wrote:
>> On Sat, 25 Jun 2005 20:54:14 GMT, Richard Harke staggered into the
>> Black Sun and said:
>>> I am trying to draw a hyperbola. I have very simple code to draw the
>>> three axes and that displays. if I add a call to sinh and cosh to
>>> calculate a point on the hyperbola, I get nothing, not even my
>>> coordinate axes.
>> You may wish to fprintf() the values you're getting from sinh()
>> and/or cosh() to stderr, just to make sure the functions aren't
>> returning "domain error" or "range error" or NaN or something that
>>> Either way, calls to sinh and cosh are in the display callback
>> If this is 3D, you need to make sure the shape you're drawing isn't
>> between the camera and the light source. Try restricting the X..Y
>> range from -1..1 and moving the camera to 1.5,1.5,1.5 look_at 0,0,0.
> I know my image is in the right place wrt the camera because with the
> calls to sinh and cosh it is fine.

Huh? You said in your original message that it *wasn't* fine. Or did
you mean "without"? (Saying "can" for "can't" is a Kentucky or
Tennessee speech marker--is with/without a new speech marker?)

> I can substitute an expression using calls to exp and get the image I
> want. But it also appears that the problem has nothing to do with
> openGL but something is badly wrong with sinh and cosh.

sinh and cosh are implemented in terms of exp according to the man pages
for sinh and cosh. cosh(x) is (exp(x) + exp(-x)) / 2 , f'rexample.
Unless your libm is totally whacked, of course. What's the output of
"ls -l /lib/libm*" ?

> I have tried a little test program with no openGL, just printf.
> The expression with exp is fine but sinh and cosh give crap.
> I guess I need a more appropriate forum to follow up.

Maybe the libm people? I don't know off the top of my head who
maintains libm. I'm using libm 2.3.2 here, but if I do something like:

for(d=0;d<1.5;d+=0.1){
        printf("d=%f , cosh=%f , exp=%f\n",d,
        cosh(d),((exp(d) + exp(-d)) / 2));
        }

...I get the exact same numbers for cosh= and exp=. They may not be the
*right* numbers (it's been a while since I had to use hyperbolic
cosines), but they're exactly the same.

-- 
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /    mail: TRAP + SPAN don't belong
http://www.brainbench.com     /                Hire me! 
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume


Relevant Pages

  • Re: openGL problem
    ... >> I can substitute an expression using calls to exp and get the image I ... >> openGL but something is badly wrong with sinh and cosh. ... > Unless your libm is totally whacked, ...
    (comp.os.linux.x)
  • Re: openGL problem
    ... > getting from sinh() and/or cosh() to stderr, ... > (POVRay terminology, sorry, I don't know the OpenGL equivalents, but the ... > works more like what you want, you've got a camera positioning problem. ...
    (comp.os.linux.x)
  • Re: angular velocity
    ... >> coefficient second order ODE's than expressing it in terms of ... Yes, but if, as frequently happens, your boundary conditions are in ... calculated for the {cosh, sinh} pair. ...
    (sci.math)
  • Re: whats wrong with this argument?
    ... On Mon, 13 Jun 2005, The World Wide Wade wrote: ... >> Integrate by parts twice. ... > No, therefore sinh x - cosh x is constant, which it is. ...
    (sci.math)