Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / 3D Maths Tutorial

Author
Message
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 23rd Oct 2008 17:50 Edited at: 23rd Oct 2008 18:04
This tutorial explains things like vectors and matrices, and how they actually work.
You should have a basic knowledge of trigonometry, which you can get from my other tutorial: Programmers Trigonometry Tutorial

Contents
Vectors:
- Explanation
- Dot product
- Cross product

Matrices:
- Explanation
- Building a scaling matrix
- Building a translation matrix
- Building a rotation matrix
- Multiplying matrices
- Inverse matrix

It was proof-read by Grandma (except for the bit about inverting matrices) and is attached in .PDF format.

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!

Attachments

Login to view attachments
calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 23rd Oct 2008 18:46
You need to mention that the matrices are multiplied in the opposite order to how you want to do the transformations. Finally you would multiply that matrix by the vector.

For example:

To do the following transformations on a point X,Y:

(X,Y) -> Rotation -> Enlargement -> Shear -> (NewX,NewY)

You would need to multiply the matrices like this:

(NewX,NewY) = ((Shear*Enlargement)*Rotation)*(X,Y)

The optomist's right, The pessimist's right.
bob_marley
16
Years of Service
User Offline
Joined: 19th Sep 2007
Location:
Posted: 24th Oct 2008 16:32
Thats very good, matrices still confuzzle me a bit, but that cleared my own vague understanding a little.

Will help some people i reckon but 3d maths is a heavy topic.
Diggsey
17
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 27th Oct 2008 10:25
Yes, 3d maths is a very large topic, and there's still a lot not covered, but this tutorial is just supposed to give you an understanding of matrices, and some formulas for dealing with them.

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 27th Oct 2008 14:55
I've added this to the tutorials thread. Good work.

cyangamer
15
Years of Service
User Offline
Joined: 2nd Jun 2008
Location: Houston, TX, USA
Posted: 27th Oct 2008 22:12 Edited at: 27th Oct 2008 22:13
I read through it, and it's very in-depth and informative. There's one question that's always been bugging me and it's not in here:

What useful features come from using 3D Maths? It all sounds interesting, but it has never piqued my interest because I've never been able to come up with any uses for it. They were implied in the tutorial, but what about examples?

Currently working on - Enemy AI and Action Battle System

the sig limit needs to be raised...
calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 27th Oct 2008 22:28
The useful features of vectors and matrices are:

Matrix transformations (rotation,stretch,shear)
Vector offset
Scalar products (useful for mechanical caluculations involving force, displacement and work)
Fields (a vector stored at every point in space)
Position (a 3-element vector)

The list is endless...

The optomist's right, The pessimist's right.

Login to post a reply

Server time is: 2024-03-29 12:52:23
Your offset time is: 2024-03-29 12:52:23