Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 07 November 1999 - 09:36 AM
A = side a
B = side b
C = side c
B² + C² - 2BC/A²
Hopefully that helped. You could just figure out the 3rd side or make one up until you get what you're wanting.
Posted 07 November 1999 - 10:13 AM
Also, pretty sure the cosine rule is for SAS, not SSS, and it reads:
a^2 = b^2 + c^2 - 2bc cos A
That gets you the third side given two sides and the included angle.
- Splat
Posted 07 November 1999 - 10:55 AM
Let vA be one of your sides (tail at the origin) and vB be the other side (tail at the origin).
Then you can use this formula to find the angle between any two vectors (works in n-dimensions too :-)
angle = acos (vA . vB / (|vA| * |vB|))
Note that "vA . vB" is the inner (dot) product of vA and vB, and |vA| represents the magnitude of the vector vA.
I believe this formula is derived from the cosine rule which Splat stated.
Posted 07 November 1999 - 11:02 AM
cos A = (b^2 + c^2 - a^2) / 2bc
Then I can use the arc-cosine function to find the angle A:
acos(cos A) or
acos((b^2 + c^2 - a^2) / 2bc)
I think that will work.
Posted 07 November 1999 - 10:55 PM
I think I will use my brains for a while to point out that it is hardly possible (with my undrstanding)
Since a traingle can be everything, you can use Pythagoras to solve this. So you need something else.
You only know two sides, and would like to knw the angle between them. This is NOT possible. If you just think about it. If the length of one side is 2 and the other is 3. Then the angle could be anything...let's just say 45. But the same angle could be with lengths of 1000 and 345. Tha \t doesn't matter.
You can only solve this equation if you know, for, instance the length of 3 sides.
This could be accomplished if you know both the starting position and end position of each line of the triangle. This would also make it much easier. You probably have those coordinates, because you write them (probably) to the screen, and you could just use those.
Now I am thinking about it. If you are absolutely sure that the angle is less than 90 degrees, then you might want to try to make a line right up to the other one, and see where that line will collide with again the second line
(ie. line a, b and c....line c, right at a, and see where c hits b)
Then you could use Pythagoras.
Enough brainstorming, wasn't f any help I think
------------------
Dance with me......
Posted 08 November 1999 - 10:17 AM
- Splat
Posted 08 November 1999 - 11:20 AM
We have two lines a and b. line a has the end coordinates (ax,ay) and the shared coordinate (abx,aby). Line b is (bx,by) to the shared (abx,aby). From the two "loose" endpoints we create a third line, c. The coordinates in wich this line exists is (ax,ay) and (bx,by).
The length of a and b is given. Length of c is sqr((ax-bx)^2+(ay-by)^2).
Geometric laws (Cosine rule): c^2 = a^2 + b^2 - 2abCos© // (C is the wanted angle)
wich means that Cos© = (c^2-a^2+b^2)/(-2ab)
I think that this would be the best way to deal with the situation.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.