Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

FlyingDutchman

Member Since 01 Aug 2011
Offline Last Active Jan 13 2013 02:16 PM
-----

Topics I've Started

OpenSource 2D RPG Engine iOS (OpenGL, C++)

10 April 2012 - 02:39 AM

Hey Community,

i decided yesterday to open source my 2d Engine and did it today in the morning. The link to my github can be found on http://howtomakeitin...m.wordpress.com . (stupid name i know)

The code is approx. 9 months old and it was the first time i wrote something big like this so don't be angry if it is not so beatiful as it should be :-) I wrote everything from scratch, the rendering, the script engine, the animation engine etc.

The source code to the level editor will follow next week. It is written in Objective C cocoa and C++ (same rendering code as the game)

Have fun,
Markus

Angle between two vectors - the law of cosines - derivation problem

11 February 2012 - 03:23 AM

Hello math community,

i am studying for math at the moment and I am stuck a bit with the derivation of the law of cosines. First of all, sorry if i mention some things wrong, I study in german so it could be that we name some things different. :-)

My problem is that i don't know how to go on after a certain step. It would be cool if you could point me in the right direction .

Problem:

Derive the law of cosines from a triangle made of 2 vectors

a = { ax, ay az }
b = { bx, by, bz }

c = b - a

All lengths are unknown and arbitrary.

So, we are looking for c, alpha, beta & gamma

alpha is between c and b
beta is between c and a
gamma is between a and b

the longest side is c which can be separated into p and q which will give me two right angled triangles.

From this information i can easily get

cos alpha = p / b -> p = b * cos alpha

cos beta = q / a -> q = a * cos beta

c = p + q

c = b * cos alpha + a * cos beta

so far so good ^-^

In the book is written that I shall do the same for the sides a and b. And that is were i get stuck. All the time i am calculating the same stuff on and on again but i am not able to go one step further. It seems that i am missing some variable or s.th.

Lets say the opposite leg of alpha is h


so b = sqrt ( p * p + h * h )

p = cos alpha * b

h = ??? <- how

i ??


The goal is to get

c*c = a*a + b*b - 2ab*cos gamma

PARTNERS