• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Tire

Real easy math question...

9 posts in this topic

If I remember my math lessons right there is something called 'cosinus regel' (maybe translated to cosine rule?), but unfortunately I've forgotten this (doh!).
0

Share this post


Link to post
Share on other sites
It's either that or the law or sines...Here is the formula for the law of cosines to get angle a from entering all 3 sides:

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.

0

Share this post


Link to post
Share on other sites
Actually, in triangle trigonometry you need to know THREE things; either three sides, two sides and the INCLUDED angle, or one side and the two adjacent angles. Just two sides will not give you anything.

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

0

Share this post


Link to post
Share on other sites
Linear algebra to the rescue!!

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.

0

Share this post


Link to post
Share on other sites
Thanks for refreshing my memory. I think I got it. If c and b are my known sides and A is the desired angle between c and b (SAS) then I can figure out side a with the distance formula because I know the points that make up lines b and c. Now I can use the law pf cosines and solve for cos A:

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.

0

Share this post


Link to post
Share on other sites
I don't think you have got it. I mean, you don't have the a, so you can't use the cosine rule.

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......

0

Share this post


Link to post
Share on other sites
Basically, as I said above, you need to know THREE OR MORE things about a triangle to figure out the rest. With two sides you have an infinite number of possibilities. SAS, ASA, SSS, SAA contain enough knowledge to get you the rest of the triangle, but AAA and ASS don't.

- Splat

0

Share this post


Link to post
Share on other sites
Yes, in pure mathematics, this problem can not be solved (we do need to know three things), but since this most certanly will be plotted to the screen or something, we would know the coordinates! (strange thing would be if we din't!) So set up things like this:

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) // (C is the wanted angle)

wich means that Cos(C) = (c^2-a^2+b^2)/(-2ab)

I think that this would be the best way to deal with the situation.

0

Share this post


Link to post
Share on other sites
I want to find the angle between two sides of a triangle. Is it possible to find one of the angles of a non-right triangle if all I know are the lengths of 2 sides? If so, how?
0

Share this post


Link to post
Share on other sites