
Simple Trig Help
I like doing programming but I have a roadblock when it comes to math. As sad as it is, I'm probably the worst at math in my programming class. Don't know why. But for fun I'm making a tree algorithm to generate a branching tree graphic that I will use later. The problem I'm having is with simple trigonometry. Each limb will generate 2 more limbs off of it that is 1/2 the size and pointed in a random direction. All I need to do is generate a random number that is the angle the branch is pointing. But when I record the x/y coordinates the angle does not matter, just the starting and ending x/y coordinates. Here is a graphic I've done to illustrate what I'm trying to find
http://img691.imageshack.us/img691/4341/simpletrig.png
I've tried drawing some right triangles to see if something would click for me but no luck xD

http://www.mathhelpforum.com/mathhe...047branch.jpg
Refer to my edited image of your branch.
Since the angle counterclockwise from A to B is 290 degrees, we can find the angle of BAC by subtracting 270 from it.
Once you have that angle BAC or CBA, you can solve the triangle using the sine/cosine rule. All you need to know is the length AC and BC. Once you have those lengths, you can add them to the coordinates of A(800,600) to get the coordinates of B.

I can't see your image so I'm not really understanding.
1. Why would subtracting 270 from 290 give us BAC? AC could change without ever affecting the angle of AB.
2. I already know the lengths of AB and AC. It's 30 units. But they do not necessarily form right angles (and do not in the illustration either).
3. Adding 30 to (800, 600) would give me the coordinates of the branch if it were at a perfect 45 degree angle and grew %50 the original size.

1 Attachment(s)
http://www.mathhelpforum.com/mathhe...048branch.png
Can you see my image now?
The reason why you are not getting it is beacuse you don't know where point C is, because you couldn't see my edited diagram.
2. AC is NOT 30 units. AB is 30 units, you need to use trig to find length AC and BC. You need to make it a right angle triangle yourself to solve it.
3. It is not 30 units vertical and horizontal.
Attachment 19057


Correct. That is for the length BC. For the length AC, you would use cosine.