• 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
Motoky

3D Line Equation?

6 posts in this topic

I am currently learning from a book called Beginning Maths and Physics for Game Programmers. I had trouble with this book quite early on due to the fact that I had completely forgotten most of the maths I had learnt at school so I went through some Algebra and Linear Algebra books to help me and I feel I am doing better with this book, this time around.

 

Now, I am confused about a question in the book. It says, "Find the equation of a line connecting the following pairs of points:"

 

It continues to list a few points for a 2D coordinate system, but the last two is a 3D coordinate system and the two points for one of the questions are:

 

(2, 0, -1) and (3, 4, 5)

 

Now, the book doesn't tell you at all how to find out how to get the equation of three points, only two. I have tried applying different ways of doing it, but it never turns out right. I would have thought, when you come to exercises or tasks, you should be at least taught how to do it and not thrown into the dark because you learnt how to do the bare minimum.

1

Share this post


Link to post
Share on other sites

It's the same equation,

 

p = a + (b-a) * t

 

where a and b are the endpoints of the line and t ranges from 0 to 1 (unless you want the infinite line through the points, where t can be any real number).

 

Just set a = (2, 0, -1) and b = (3, 4, 5) and you are good to go... isn't that what you did in the 2d case?

2

Share this post


Link to post
Share on other sites

For 2D, the book gives you this formula to get the equation:

 

(y - y1) = m(x - x1)

 

y1 and x1 being the first coordinates. m being the slope.

 

So, one of the questions in the book is to find the equation of 2D points as well, like:

 

(0, 10) and (5, 0)

 

(y - 10) = m(x - 0)

 

m = (0 - 10)/(5 - 0) = (-10)/5 = -2

 

y - 10 = 2x

 

y = 2x + 10

 

 

Anyway, there is only a little bit of info in the book, the answer isn't even an equation, but it's a vector...

 

You have:

 

?x = x2 - x1

?y = y2 - y1

?z = z2 - z1

 

So with the coordinates, (2, 0, -1) and (3, 4, 5), it would be:

 

?x = 3 - 2 = 1

?y = 4 - 0 = 4

?z = 5 - (-1) = 6

 

This is why I was confused because it was asking for an equation, not a vector... The answers were a bit further on. So I got them right, but it wasn't really worded very well because I was trying to find an equation...

 

Thanks anyway.

0

Share this post


Link to post
Share on other sites
What Paradigm Shifter posted is a parametric equation. What you seem to be looking for is an implicit equation. The problem is that a single linear equation in R^3 describes a plane, not a straight line. You can use two equations to describe your line, for instance like this:

4*x -13*y +8*z = 0
      3*y -2*z = 2
2

Share this post


Link to post
Share on other sites

?x = 3 - 2 = 1
?y = 4 - 0 = 4
?z = 5 - (-1) = 6

I think this is just a hint towards the proper equation - the ? values represent only the (b-a) vector from Paradigm Shifter's answer. Sometimes, books don't give you full answers for the exercises, just because they want you to figure out stuff by yourself.

 

But some commenters on Amazon say that this book is filled with errors, so who knows... Maybe you should focus on the theory rather than the exercises.

Edited by tonemgub
0

Share this post


Link to post
Share on other sites

I've come across some books that are really detailed and go through how they solve something and I prefer. I hate books that just give you an answer without any meaning behind it and expect you to figure out for yourself if you don't have a clue what some symbols might even mean or why nothing is actually showing up on the internet because they have written it down differently.

 

Anyway, I got passed that and onto the next set of exercises which is about finding the slope, y-intercept for each equation and the number of solutions. Well, I thought that a system of equations had to consist of more than one equation, if they don't, then I am completely lost because not even my previous books showed a system of equations with just one equation...

 

Anyway, the equation is:

 

x + y = 7

 

So the slope would be -1. The y-intercept would be: y = -x + 7.

 

Earlier in the book it tells you that to find out how many solutions a system of equations has by checking to see if the slopes of both equations are the same. If they are NOT the same, it has one solution, if it does, you then need to find the y-intercept and check to see if b1 and b2 are the same. b1 in this question would be 7.

 

So I have m1 = -1, and b1 = 7. The answer gives me that, but with m2 = 1/3 and b2 = 2/3, with only one solution.

 

I know you mentioned that I should focus on the theory and I guess understanding how it works, but I just wish someone could shed some light on this one so I can move on. If all of the exercises are like this, where they are giving me false answers or not explaining how they got the answer, I just don't see the point in the exercises...

1

Share this post


Link to post
Share on other sites
It looks like the book is missing a second equation in that system. It's probably this one:

-x + 3*y = 2

Someone said that the book is known to have mistakes. If this bothers you, perhaps you should get a different book. Edited by Álvaro
1

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