• 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.
Sign in to follow this  
Followers 0
JoeJ

How to center a rotated line between two angles

7 posts in this topic

I want to calculate the distance d that moves the beta angled blue line out of unit circle center so that both alpha angles are equal.

Seems not so easy than i initially thought - please help :)

 

2mzxy7c.jpg

-1

Share this post


Link to post
Share on other sites
Figure out the lines that delimit "alpha", intersect them with the blue line, take the middle point of both intersections, measure the distance to the center of the circle.

Do you think that solves your problem? Is there a step you don't know how to implement?
1

Share this post


Link to post
Share on other sites

Thx, but that would be only a part of the solution - Initially i have the line at the light blue position and alpha is unknown.

Note that if beta angle becomes larger, there should be more movement in d direction and alpha angle becomes larger too.

 

If i'd know alpha i could calculate d and vice virsa.

But if beta is 90 deg., any solution for d is correct, but alpha is 90 deg. So asking for alpha would have been wiser than asking for d.

 

I tried things like   sin(alpha) = pow(sin(beta), 2)   or   sin(alpha) = sqrt(sin(beta))

Both work for 0 and 90 degree case, but not in between.

0

Share this post


Link to post
Share on other sites

I'm near a solution, I must verify it and post it, but I won't be at the PC for few hours now so it will probably won't be sooner than in like 4 hours. And it isn't so easy, indeed ;)

0

Share this post


Link to post
Share on other sites
I spent a little bit of time trying to figure this out using the facts about geometry of a triangle that I used to know when I participated in Math competitions. It turns out it's been too long and I don't remember enough to tackle this one.

On the other hand, you have a computer. That means you can numerically solve pretty much anything without much effort. For instance, you could follow the procedure I described earlier and measure the length of the blue segment. If it's too long, increase alpha. If it's too short, decrease it.

What's the situation where you need to solve this problem?
0

Share this post


Link to post
Share on other sites

So, I ended with a quadratic equation, so there are two solutions, but one of them quite doesn't make sense, but you'll see when you try it (it gives you a negative d so large that the line would be completely out of the circle).

 

The quadratic equation looks like this:

 

d^2 * sin(beta) + d * R - R^2 * sin(beta) = 0

where d is your unknown variable, beta is the angle and R is radius of the circle. You said a unit circle so R probably will be 1, but it was better to make it universal I think ;)

 

The better of the two solutions is:

D = R^2 + 4 * (sin(beta))^2 * R^2

d = (-R + sqrt(D)) / (2 * sin(beta))

Because of one algebraic operation I did in the process, there arose a condition that cos(beta) cannot be zero. Which makes sense, because that's true for beta = 90°.

 

 

If you're interested in the whole calculation, let me know and I'll post it somehow.

Edited by Tom KQT
0

Share this post


Link to post
Share on other sites

I tested it a little bit more and it is working as expected.

 

May I please ask you - next time let us know on the forum when you aren't looking for the solution anymore. It's quite sad when somebody else is spending a good amount of time solving your problem for you, just to find then that you didn't probably even read the thread.

2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0