Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Cosinus and Sinus, my whorst enemies

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Seventh district of hell, third door on the left
    Posts
    6

    Cosinus and Sinus, my whorst enemies

    As you might have suspected, I'm not a real doctor.
    I'm new to 3D coding and have just begun a search for the best 3D API available. Now that I have found OpenGL, I find myself with another problem. Cosinus and Sinus are two mathematical functions wich are used in 3D Graphics extensively, yet I don't understand what exactly they do. I feel that once I master this, I will know how to draw spherical and circular objects in OpenGL, and be able to rotate objects in 3D on the screen. I never whent to school, so it's not realy something I could have done something about. Can someone, anyone, give me a brief explanation of what exactly the use is of these two functions, and why they keep popping up in 3D code?
    Thank you.
    Dr. Crap, PHD, resolves all you're doctory needs, asswell as you're other needs ...

  2. #2
    Intern Contributor
    Join Date
    Feb 2000
    Posts
    89

    Re: Cosinus and Sinus, my whorst enemies

    I assume you meant sines and cosines?
    Certainly this is a fundamental issue which is just one of many that you're going to have to get your head around to do 3D programming (the other BIGGIE is matrix math).
    Here's one way to understand it:
    sine, cosine and tangent are 3 trigonometry functions which relate angles and lengths of sides of a right triangle and are defined this way
    T = the angle of interest
    A = side of triangle Adjacent to T
    O = side of triangle Opposide T
    H = the hypotenuse (sp?) (angle opposite the right angle).
    ````````/|`````
    ```````/`|`````
    ``````/``|`````
    ``H``/```|`````
    ````/````|`O```
    ```/`````|`````
    ``/``````|`````
    `/`)T````|`````
    ---------+`````
    `````A`````````
    cos(T) = A/H
    sin(T) = O/H
    tan(T) = O/A
    These functions are useful for all sorts of things. For example if you want to break an arbitrary vector up into x and y components, you find the angle the vector makes with the x-axis of your coordinate system and H = length of the vector and you get:
    x_component_of_H = A = H*cos(T)
    y_component_of_H = O = H*sin(T)

    I hope that's a decent start for you.

    -Rob

    [This message has been edited by Rob (edited 02-21-2000).]

    [This message has been edited by Rob (edited 02-21-2000).]

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Seventh district of hell, third door on the left
    Posts
    6

    Re: Cosinus and Sinus, my whorst enemies

    It most certainly is!
    Thank you very much Rob!!!
    Dr. Crap, PHD, resolves all you're doctory needs, asswell as you're other needs ...

  4. #4
    Guest

    Re: Cosinus and Sinus, my whorst enemies

    Check this site out, I think you may find it quite handy.

    http://mathworld.wolfram.com/

    If you are just looking to find co-ordinates to generate surfaces with then look up the parametric equation for the shape in question.

    eg.

    The parametric equations for a circle of Radius r is

    x = r*cos(theta)
    y = r*sin(theta)

    Unfortunately most really interesting shapes are not so easily generated and you have to use meshes to render them. Which means creating code to load objects.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •