It looks like you're new here. If you want to get involved, click one of these buttons!

- 141K All Categories
- 103.8K Programming Languages
- 6.5K Assembler Developer
- 1.9K Basic
- 40K C and C++
- 2.9K C#
- 7.9K Delphi and Kylix
- 4 Haskell
- 9.7K Java
- 4.1K Pascal
- 1.3K Perl
- 2K PHP
- 551 Python
- 37 Ruby
- 4.4K VB.NET
- 1.6K VBA
- 20.9K Visual Basic
- 2.6K Game programming
- 317 Console programming
- 92 DirectX Game dev
- 1 Minecraft
- 112 Newbie Game Programmers
- 2 Oculus Rift
- 9K Applications
- 1.8K Computer Graphics
- 744 Computer Hardware
- 3.5K Database & SQL
- 535 Electronics development
- 1.6K Matlab
- 628 Sound & Music
- 258 XML Development
- 3.3K Classifieds
- 199 Co-operative Projects
- 198 For sale
- 190 FreeLance Software City
- 1.9K Jobs Available
- 604 Jobs Wanted
- 210 Wanted
- 2.9K Microsoft .NET
- 1.8K ASP.NET
- 1.1K .NET General
- 3.4K Miscellaneous
- 7 Join the Team
- 355 Comments on this site
- 70 Computer Emulators
- 2.1K General programming
- 187 New programming languages
- 628 Off topic board
- 216 Mobile & Wireless
- 88 Android
- 126 Palm Pilot
- 340 Multimedia
- 156 Demo programming
- 184 MP3 programming
- Bash scripts
- 27 Cloud Computing
- 53 FreeBSD
- 1.7K LINUX programming
- 370 MS-DOS
- Shell scripting
- 321 Windows CE & Pocket PC
- 4.1K Windows programming
- 942 Software Development
- 417 Algorithms
- 68 Object Orientation
- 92 Project Management
- 95 Quality & Testing
- 269 Security
- 7.7K WEB-Development
- 1.8K Active Server Pages
- 62 AJAX
- 5 Bootstrap Themes
- 55 CGI Development
- 28 ColdFusion
- 224 Flash development
- 1.4K HTML & WEB-Design
- 1.4K Internet Development
- 2.2K JavaScript
- 37 JQuery
- 308 WEB Servers
- 151 WEB-Services / SOAP

programmeurke
Member Posts: **19**

in 3D Graphics

hi,

now i've understood the whole bunch about matrices and vectors, i found myself a good library. In that library they use 4*4 matrices, but I don't know what's in it, how many points or something like that. BTW: for rotating they only use till 0..2 of the matrix (so there are 7 numbers not used).

Secondly: vectors exist of four items: an x, a y, a z and something else.

What do you think it is, that fourth number?

Thanx in advance.

[green][b][size=5]P[/size][size=4]ro[/size][size=3]g[/size][size=2]r[/size][size=1]amm[/size][size=2]e[/size][size=3]u[/size][size=4]rk[/size][size=5]e[/size][/b][/green]

now i've understood the whole bunch about matrices and vectors, i found myself a good library. In that library they use 4*4 matrices, but I don't know what's in it, how many points or something like that. BTW: for rotating they only use till 0..2 of the matrix (so there are 7 numbers not used).

Secondly: vectors exist of four items: an x, a y, a z and something else.

What do you think it is, that fourth number?

Thanx in advance.

[green][b][size=5]P[/size][size=4]ro[/size][size=3]g[/size][size=2]r[/size][size=1]amm[/size][size=2]e[/size][size=3]u[/size][size=4]rk[/size][size=5]e[/size][/b][/green]

Terms of use / Privacy statement / Publisher: Lars Hagelin

Programmers Heaven articles / Programmers Heaven files / Programmers Heaven uploaded content / Programmers Heaven C Sharp ebook / Operated by CommunityHeaven

© 1997-2017 Programmersheaven.com - All rights reserved.

## Comments

22And matrices can also be passive or active trasformation that change the way you do what u have to do. But if we are talking of the same thing (which is the moust common way), then your matrix should look like this:

[rxx ryx rzx tx]

[rxy ryy rzy ty]

[rxz ryz rzz tz]

[0 0 0 1]

so when u multiply this matrix with a point (x,y,z,1) u get:

x*rxx + y*ryx + z*rzx + tx =new_x

x*rxy + y*ryy + z*rzy + ty =new_y

x*rxz + y*ryz + z*rzz + tz =new_z

x*0 + y*0 + z*0 +1 =1

[rxx,rxy,rxz], [ryx,ryy,ryz], [rzx,rzy,rzz] are the vectors of the x, respectly y, respectly z axis of the old coordinates system (the one you were expressing the point beform performing the trasformation). This are the "things" that particaly rotate your point in your new coordinates system. All these vectors should have lenght=1, if you dont perform scaling.

Instead [tx,ty,tz] is the traslation vector, that means that your point will be moved by this vector in order to be trasformed in the new coordinates system (x+tx, y+ty, z+tz).

[0,0,0,1] this vector is linked to the fact your are using fake 4-dimensional vectors, that's called omogenus coordinates system, but nothing I can explain within few lines, and you dont really need to know that, just figure out that in order to add the traslation we need at last a 3x4 matrix, but you can't multiply a 3x4 matrix with a 3x1 vector, you need a 4x4 matrix and a 4x1 vector to do that. But this is just a mathematical needs, when u know what u need and how to do it, you can just take away the [0,0,0,1] row to spare memory and computation time.

You said that you lib used the forth coordinate, well...I read around that it's more and more common to write a point with 4 cordinates like (x,y,z,w), w should be the "weight" (right spelled?) of the point. Ok what it's the weight of a point...I dont really know, it seems that is used for shading and maybe also for morphing, but I didn't need such a variable yet (that would be rather a vertex's charateristic, than a point's one, wouldn't it ?).

Anyway if the forth raw of the matrix contain some kind of trasformation aplied to the weight, they aren't done as the a mathematical matrix multiplication 'cause It will scale the traslation vector and modify the point's coordinates, the wight would also be corrupted by the coordinates...quite a mess.

Mutilate