[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 696: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 696: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 696: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 696: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 696: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 696: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 696: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 696: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 696: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 696: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
Knights of Reason - Forums • View topic - Linear Algebra: Math for threedees
FAQ  •  Register  •  Login

Linear Algebra: Math for threedees

<<

Curved

New Granger
New Granger

Posts: 71

Joined: Sun Apr 26, 2009 12:08 am

General In-Game Name:

Post Wed May 12, 2010 12:08 am

Linear Algebra: Math for threedees

Linear Algebra is the maths that games use to do cool 3D stuff. Its easy to understand and will blow your mind with awesomeness.

Vectors: This is a way to measure 3D directions/distances. A 3D vector is written down like this: <2,3,4>. Each number stands for a different dimension (x,y, or z). This is also the exact same way to store a 3D position, but a vector is different. A vector represents a direction (right, left, up, down, somewhere in-between), and a distance (5 feet). If you walked 3 feet forward, you would write that vector like this: <0,0,3>. If you walked up some stairs, and in doing so you happened to have moved 3 feet forward and 2 feet upward, you'd write that like this: <0,2,3>. A vector is measured from the universal center of the universe, "the origin" (that's <0,0,0>). This way of writing down directions and distances is handy because there are lots of tricks you can easily do with it.

tip: imagine a vector as an arrow, starting at the origin, and ending at its components.

More: http://en.wikipedia.org/wiki/Euclidean_vector

Adding Vectors: If you walk two feet forward, and then two feet to the left, you'd be adding two vectors together. That looks like this: <0,0,2> + <0,2,0> = <0,2,2> (just do normal addition to each component separately). If you layed an arrow down for each of the two movements in the example above, the second movement's arrow would start at the end of first arrow. When you add two vectors together like this, you can imagine the resulting vector by laying down the arrows end to end like that.

Image

More: http://en.wikipedia.org/wiki/Euclidean_ ... ubtraction

Subtracting Vectors: If you and your friend went home from school, and you walked 1 mile north and he walked 1 mile west, what would be the vector between you two by the time you both got home? That looks like this: <0,1,0> - <-1,0,0> = <1,1,0> (just do normal subtraction to each component separately). If you layed an arrow down for each you and your friend starting at the school, a subtraction can be imagined by drawing another arrow between each of the end points, with the arrow pointing toward the "first" one. E.g, if you subtracted vectors A and B (A-B), the arrow would point toward A's end point.

Image

More: http://en.wikipedia.org/wiki/Euclidean_ ... ubtraction

Vector Length: A vector stores both "direction" and "distance", but you can't just look at a vector to see how long it is, cause its three numbers! Since all of the components (x,y,z) are at right angles to each other, you can use that old fart Pythagorean to get something out of it. length = sqrt(x*x+y*y+z*z)

More: http://en.wikipedia.org/wiki/Euclidean_vector#Length

Normalization: A vector stores both "direction" and "distance", but sometimes you don't want the distance part. In this case, you find a vector with a length of 1, aka a unit vector. This is called normalizing a vector (not to be confused with a polygon normal vector). To do this, find the length of the vector, and then divide each component by that length: l = length(V); unitVector = <Vx/l,Vy/l,Vz/l>.

More: http://en.wikipedia.org/wiki/Euclidean_ ... nit_vector

Multiplying Vectors: Vectors are a bit more complicated than scalars. There's three different things you can do that are kind of like multiplication: scaling, dot product, and cross product.

Scaling: Say you would like to have a vector that is exactly in the same direction as another vector, but is twice the length. You scale the source vector. This is the easiest kind of multiplication-type thing: scaledVector = <Vx*scale,Vy*scale,Vz*scale>.

A nice trick is if you want to find a vector that is in the same direction as another vector, but exactly so many units long, normalize the source vector (bringing its length to 1) and then scale it to how long you want it to be.

Image
Image

More: http://en.wikipedia.org/wiki/Euclidean_vector#Length

Dot Product: A dot product is a computationally fast operation that indicates how close in direction two vectors are. If you imagine two vectors starting at the same origin, the dot product gets the shortest angle between them. Well ... not exactly the angle, but in fact the arc-cosine multiplied by both of their lengths. But basically, what this means is if two unit vectors are pointing exactly in the same direction, their dot product is 1. If they are at exactly right-angles to each other, their dot product is 0. If they are exactly pointing away from each other, their dot product is -1. If they are somewhere in between, they will be 0.xxx if the angle between them is less than 90, and -0.xxx if the angle is greater than 90. This is surprisingly useful information, since it is basically a "percent" of how close they are. A dot product looks like this: dotProduct = Ax*Bx + Ay*By + Az*Bz. -- Yes, surprisingly simple for so complex of a result. It is definitely a thing of beauty.

Image

More: http://en.wikipedia.org/wiki/Euclidean_ ... ot_product

Cross Product: The cross product is used to find a vector that is exactly perpendicular to two other vectors. Now hold out your right hand in a fist. Just do it fag. Straighten out your thumb and pointer like you're making a gun. Those are two vectors. Now straighten the second and third knuckles of your middle finger (but not the big knuckle). The middle finger is a vector that's perpendicular to the first two -- its the cross product.

Image

Here's what a cross product looks like (Its quiet ugly looking to me):

crossProduct = <Ay * Bz - By * Az, Az * Bx - Bz * Ax, Ax * By - Bx * Ay>

Cross products are used in a variety of ways to construct new vectors. For instance, if you had a triangle polygon, you could get the direction that faces directly up by performing a cross product on two of the edges of the polygon. (You could get those edges by subtracting the vertices from one another). This vector sticking directly out of a polygon is called a normal! We use normals a lot in 3D graphics, so this is a nice trick to know.

More: http://en.wikipedia.org/wiki/Euclidean_ ... ss_product

Next time: How to figure out how long your shadow is.
Last edited by Curved on Thu May 13, 2010 4:08 pm, edited 10 times in total.
Image
<<

Axis

User avatar

Core Global Moderator
Core Global Moderator

Posts: 3614

Joined: Wed Jun 25, 2008 6:02 pm

General In-Game Name:

Post Wed May 12, 2010 12:36 pm

Re: Linear Algebra: Math for threedees

You guys both lost me at linear. May I ask what the relevance of this topic is?
Image
Image
<<

Robmanx

User avatar

Core Administrator
Core Administrator

Posts: 5781

Joined: Sun May 25, 2008 2:45 pm

Post Wed May 12, 2010 12:37 pm

Re: Linear Algebra: Math for threedees

what's a threedee?

<<

Axis

User avatar

Core Global Moderator
Core Global Moderator

Posts: 3614

Joined: Wed Jun 25, 2008 6:02 pm

General In-Game Name:

Post Wed May 12, 2010 3:48 pm

Re: Linear Algebra: Math for threedees

Sounds mighty complicated but maybe one day I will look back at this thread and find some use in it. :o
Image
Image
<<

Saturn

User avatar

Core Moderator
Core Moderator

Posts: 2218

Joined: Tue Apr 14, 2009 3:22 pm

Location: 6th Planet from the Sun

General In-Game Name:

Post Wed May 12, 2010 5:25 pm

Re: Linear Algebra: Math for threedees

I like math. But like Axis, I got lost too in linear. :evil:
Image
Image
<<

halifix

User avatar

Core Moderator
Core Moderator

Posts: 314

Joined: Tue Apr 08, 2008 6:02 am

General In-Game Name:

Post Wed May 12, 2010 5:30 pm

Re: Linear Algebra: Math for threedees

Linear algebra is midlevel math. It's generally taught after calculus, although it doesn't build on it; it has more relations with algebra 2, and the vector component of precalculus. My college teaches the basics along with differential equations, then the theory in a seperate course.

If you want to learn the basics of it, go read Wikipedia or something, it'll tell you what Curved just said. I don't really care much about linear algebra except for its relations to Fourier analysis, a class I'm taking. I know nothing about programming, but I'm fairly sure anyone who'd have a use for linear algebra would not learn it from this forum.
<<

Curved

New Granger
New Granger

Posts: 71

Joined: Sun Apr 26, 2009 12:08 am

General In-Game Name:

Post Wed May 12, 2010 8:51 pm

Re: Linear Algebra: Math for threedees

Nah, wikipedia sucks for practical math. It only has the theoretical stuff, cause its written by math people. In fact, I'll go out and say that most "math" people really piss me off, because they have confidence issues and try to impress everyone around them with big words. Math and programming for that matter are simple as hell, but most teachers purposefully try to make them sound impressive and big so they can go on ego trips.
Image
<<

Curved

New Granger
New Granger

Posts: 71

Joined: Sun Apr 26, 2009 12:08 am

General In-Game Name:

Post Wed May 12, 2010 10:09 pm

Re: Linear Algebra: Math for threedees

Curved versus Math Teachers: watch out, he's a dretch!
Image
<<

halifix

User avatar

Core Moderator
Core Moderator

Posts: 314

Joined: Tue Apr 08, 2008 6:02 am

General In-Game Name:

Post Thu May 13, 2010 5:54 am

Re: Linear Algebra: Math for threedees

Wikipedia works just fine for finals when you haven't attended class in the past month.

This is a typical conversation about my major:
"What major are you?"
"Math."
"Oh really? I hear that's really hard!"
"Yeah, it's pretty hard."
"I took ***** in college/a certain year!"

Sometimes there's a line about my school. That's about it. As for being obnoxious, that's possibly because no matter what math class you take, people will be scared it will be too hard for them, and these are legitimate fears, so professors often try to downplay the difficulty of a course through their teaching style. I haven't encountered an "easy" math since high school.
<<

Curved

New Granger
New Granger

Posts: 71

Joined: Sun Apr 26, 2009 12:08 am

General In-Game Name:

Post Thu May 13, 2010 3:03 pm

Re: Linear Algebra: Math for threedees

Competitive strategy says whoever owns the valuable commodities is indicated to be winning.

If someone thinks everyone around them is the competition, they will collect commodities to make themselves win.

In a world where knowledge is a commodity, those who declare that their knowledge is most precious could see themselves as winners.

In reality, little knowledge is precious in its complexity, and the range in human intelligence is small.

However, knowledge is precious in its availability, and some people like it that way because it makes them feel like winners.

The truth is that I've taught 8 year olds linear algebra, and 60 year olds how to program. None of it is complex if the teacher doesn't act like he is god descended. The sad thing is that so many people are traumatized from school that they think they could never learn those things -- but every time I've tought someone who has said that, they wondered why they were so afraid by the end of it. That's why I hate elitist people of all colors -- people who purposefully withhold something from others so they can feel better about themselves. Math people, from my experience, often are a particular flavor of that ice cream.

edit: Whether you (iku) are this kind of person, I don't know, cause I don't know you very well yet. I've been friends with extremely elitist smart people before also. However, when I'm trying to teach people something, and they give me that "Math is hard" line, I know they just had a really shitty teacher once, and that just makes me so mad. If the world didn't have that, can you imagine how many albert einstiens would have been discovered by now?
Image
<<

Curved

New Granger
New Granger

Posts: 71

Joined: Sun Apr 26, 2009 12:08 am

General In-Game Name:

Post Thu May 13, 2010 3:52 pm

Re: Linear Algebra: Math for threedees

Updated with wikipedia links and the dot product detailed function.

This was written for programmers, as my effort to contribute to KoRX.

Added pictars. Thanks wikipedia.
Last edited by Curved on Thu May 13, 2010 3:59 pm, edited 1 time in total.
Image
<<

Robmanx

User avatar

Core Administrator
Core Administrator

Posts: 5781

Joined: Sun May 25, 2008 2:45 pm

Post Thu May 13, 2010 3:54 pm

Re: Linear Algebra: Math for threedees



Return to FAQ's and Howto's

Who is online

Users browsing this forum: No registered users and 2 guests