## trigonometry confusion

### trigonometry confusion

OK i know you guys are going to say go google it... I have. I actually have been confused for about a month or so doing this stuff and at this point i am still just confused. And yes i slipped through high school without ever learning trig, and passed. Plus high school for me was almost 10 years ago. So any math i had at that time,between family, kids, wife, etc. is out the window by now. My wife went back to college and is finishing up her last semester, and she is on MATH 1225 doing trig. She asks for my help all the time, except i always get the wrong answer as with her. Normally i wouldnt care as long as its passed, but after thinking about it, if i plan on doing 2d games, im gonna need to know this stuff.

I know SOH CAH TOA.

after going through some problems i think i have a forumla down and then the next problem throws a whole different formula at you. I tried to make a program to give you the answer. But the forumla changes on the fly and i dont know why?
some figure shows the side between theta and right angle is ALWAYS adjacent whereas another figure shows the opposite, displaying adjacent between the known angle and right triangle. Sometimes you convert the angle to radians and sometimes you do not. Sometimes you divide the trig funtion by the known side and sometimes you multiply the the trig function by the known side. There seems to be no set in stone rules, which makes me frustrated.

Each web site is the same too, ill get a few problems right, and then one problem the formula will be different and get itt wrong, and as i look through how they got the answer i jsut keep asking myself why did they do it like that this time when they did not do it like that the other time.

EDIT:
this is all regarding just right triangles by the way.

EDIT2:
For those of you that do program 2d games. How intense does the trig get in 2d games? I know you need basic for turning turrets towarrds the players position, or firing towards a player for example. But how much farther does it go?

EDIT3:
i put this specifically in game development as opposed to bar as it seemed more appropriate for future help pygamers.

EDIT4:
the school, after you give 3 wrong answers, just gives the answer, so we get this answer back and have no idea how they got that number to begin with so, i made this code to try to quicken the process on how they got the number. (that should describe how many times we input wrong answers, ew). I wrote it in C++ though.
Code: Select all
#include <iostream>
#include <cmath>

//SOH COH TOA

return degrees * 3.141592653589793 / 180.0;
}

void len(double degrees, double side){
double t, c, s, t2, c2, s2;
t = tan(to_radians(degrees)) * side;
t2 =  side / tan(to_radians(degrees));
c = cos(to_radians(degrees)) * side;
c2 = side / cos(to_radians(degrees));
s = sin(to_radians(degrees)) * side;
s2 = side / sin(to_radians(degrees));
std::cout << "side: " << t  << " = tan(" << to_radians(degrees) << ") * " << side << std::endl;
std::cout << "side: " << t2  << " = " << side << " / tan(" << to_radians(degrees) << ")" << std::endl;
std::cout << std::endl;
std::cout << "side: " << c  << " = cos(" << to_radians(degrees) << ") * " << side << std::endl;
std::cout << "side: " << c2  << " = " << side << " / cos(" << to_radians(degrees) << ")" << std::endl;
std::cout << std::endl;
std::cout << "side: " << s  << " = sin(" << to_radians(degrees) << ") * " << side << std::endl;
std::cout << "side: " << s2  << " = " << side << " / sin(" << to_radians(degrees) << ")" << std::endl;

}

int main(){
len(15,21);

}
we will be moving to python-forum.io on October 1 2016
more details here

metulburr

Posts: 2244
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

### Re: trigonometry confusion

metulburr wrote:I know SOH CAH TOA.

Is that something like FUS RO DAH? I can see how that would be helpful.

I don't get your post at all. Is there a question, or are you just complaining that you can't always use the same formula?
Also, you don't mention even once what kind of things you're calculating.
Friendship is magic!

R.I.P. Tracy M. You will be missed.

stranac

Posts: 1790
Joined: Thu Feb 07, 2013 3:42 pm

### Re: trigonometry confusion

FUS RO DAH

I dont know what that is.

I was referring to the remembarance of sin, cos and tangent
SOH CAH TOA.

Sin = Opp / Hyp
Con = Adj / Hyp
Tan = Opp / Adj
or rather Some Old Hippy Caught Another Hippy Tripping On Acid

anyways, I pulled one question that stumped me:
http://www.mathopolis.com/questions/q.p ... 8_3935_248

Question #3 i got right as it was what i expected the answer to be:
9.70698 = sin(1.11701) * 10.8

However Question #4 i was expecting the answer to be:
4.0762 = tan(0.471239) * 8

however the answer is:
15.7

which led me back to their formula of:
15.7009 = 8 / tan(0.471239)

So the first one they multiply the side by the trig function whereas this one they devide the trig function by the side. I don;t know why these forumlas are different, or why they devided in the first place on the second one?

This isn't the only example. If i can find the others i was having problems with ill post them too, as with those i even got the side wrong as to whether they were adj or opp.
we will be moving to python-forum.io on October 1 2016
more details here

metulburr

Posts: 2244
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

### Re: trigonometry confusion

So far all the ones including the one you had a problem with are direct applications of "SOH CAH TOA".

The one you had a problem with is looking for the adjacent side not the opposite, therefore you have to divide.

Code: Select all
tan(theta) = op/adj   ----> adj = op/tan(theta)

-Mek

As for your comments about the importance of trig; yes, this type of triangle geometry is essential. 90% of the time doing 2d stuff I would say that applying right triangle geometry and the pythagorean theorem is enough to get you where you want. Occasionally you may need some basic calculus. This enters into things when you want to start finding tangent and normal vectors/lines to other surfaces. Think arbitrary collision detection. Even then you can fudge it sometimes.

-Mek
New Users, Read This
• Use code tags when posting code.
• Include any errors with your post (in code tags).
• Describe your problem; not your chosen solution.
• Make examples the minimum length to demonstrate your issue.

Mekire

Posts: 1711
Joined: Thu Feb 07, 2013 11:33 pm
Location: Tucson, Arizona

### Re: trigonometry confusion

metulburr wrote:
FUS RO DAH

I dont know what that is.

I am shocked. How is that even possible?
Friendship is magic!

R.I.P. Tracy M. You will be missed.

stranac

Posts: 1790
Joined: Thu Feb 07, 2013 3:42 pm

### Re: trigonometry confusion

ok after doing quite a few practice test ones, i think i have the simple ones down. (i think)

I already figured this next one out but it was by pure guess. When you have all the sides, but no angle but the right angle, to use the inverse. But how do you know which inverse to use? For example: regarding to what i am refering to:
Code: Select all
angle C = 90 degrees
a = 1
c = 2

EDIT:
http://draw.to/D3Ah7Zw

which i ended up with
b = 1.7320
and
A = arcsin(1/2)
A = 30 degrees
but the problem is i guessed as to use arcsin(). How do you actually determine to use arcsin() as opposed to others?

EDIT2:
I am shocked. How is that even possible?

i had to google it to figure it out. Skyrim? lol
we will be moving to python-forum.io on October 1 2016
more details here

metulburr

Posts: 2244
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

### Re: trigonometry confusion

You need to find angle A.
You are given two pieces of information.

Those two pieces are the length of the hypotenuese and the length of the side opposite to angle A.

Therefore we know we need to use "SOH"

Code: Select all
sin(theta) = opposite/hypotenuese  ---> theta = arcsin(opposite/hypotenuese)

Therefore:
Code: Select all
theta = arcsin(1/2)

You need to use the trigonometric function that corresponds to the two pieces of information you know.

-Mek
New Users, Read This
• Use code tags when posting code.
• Include any errors with your post (in code tags).
• Describe your problem; not your chosen solution.
• Make examples the minimum length to demonstrate your issue.

Mekire

Posts: 1711
Joined: Thu Feb 07, 2013 11:33 pm
Location: Tucson, Arizona

### Re: trigonometry confusion

oooooh, now i feel like a dummy

thanks mekire. I think i am good with that now. Now on to whatever cot(), sec(), and csc are.
we will be moving to python-forum.io on October 1 2016
more details here

metulburr

Posts: 2244
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

### Re: trigonometry confusion

ok so i see csc() = H/O, sec() = H/A, cot = A/O. But why would i use csc() for example, why wouldnt you just use sin() and do O/H? Plus calcs and python.. i dont even see those types of functions.
we will be moving to python-forum.io on October 1 2016
more details here

metulburr

Posts: 2244
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

### Re: trigonometry confusion

Honestly, don't worry about the recipricol versions too much; also don't worry about the hyperbolic forms (ie sinh, cosh, tanh).

Learn your basic trig identities like:
Code: Select all
sin^2(theta)+cos^2(theta) = 1

Be aware of the law of cosines for non-right triangles.

Familiarize yourself with radians so you don't always have to fall back on degrees; and you should know in which quadrants which trig functions are positive or negative.

-Mek
New Users, Read This
• Use code tags when posting code.
• Include any errors with your post (in code tags).
• Describe your problem; not your chosen solution.
• Make examples the minimum length to demonstrate your issue.

Mekire

Posts: 1711
Joined: Thu Feb 07, 2013 11:33 pm
Location: Tucson, Arizona

### Re: trigonometry confusion

sweet. Thanks for pointing me in the right direction
we will be moving to python-forum.io on October 1 2016
more details here

metulburr

Posts: 2244
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

### Re: trigonometry confusion

A small demo of the application of some simple (long forgotten) calculus. The function and derivative are hard coded here, but it shows how we can calculate tangents and normals to well behaved functions. Just move the mouse across the screen and the tangent and normal vectors will follow.

Edited:
Made a few slight changes and threw it up on my github. The wave now scrolls.
https://github.com/Mekire/pygame-normal-tangent/blob/master/wave.py

-Mek
New Users, Read This
• Use code tags when posting code.
• Include any errors with your post (in code tags).
• Describe your problem; not your chosen solution.
• Make examples the minimum length to demonstrate your issue.

Mekire

Posts: 1711
Joined: Thu Feb 07, 2013 11:33 pm
Location: Tucson, Arizona

### Re: trigonometry confusion

i only hope to one day actaully understand that ...and duplicate it. lol. thanks
we will be moving to python-forum.io on October 1 2016
more details here

metulburr

Posts: 2244
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

### Re: trigonometry confusion

metulburr wrote:There seems to be no set in stone rules, which makes me frustrated.

It's funny, because I found quite the opposite to be true. Everything is so clear, well for now at least. As soon as you know 3 types of information from any triangle, you can calculate the rest. 3 sides, 2 sides and an arc, etc. Depending on how the known and unknown pieces of the triangle align with each other, you can use different formulas to calculate the rest. If the arc is between the 2 known sides, or next to an unknown, etc. I guess you have to wrap your head around it once, but this is no python problem. Feel free to ask anyway
Due to the reasons discussed here we are moving to python-forum.net on October 1, 2016.

This forum will be closed. Please create an account at the new site to continue discussion.

IRC://irc.freenode.net/python-forum
Kebap

Posts: 689
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe