This project has moved. For the latest updates, please go here.

UpperTriangle and LowerTriangle

Oct 24, 2012 at 10:00 AM
Edited Oct 24, 2012 at 10:01 AM

Hi,

First of all, thank you for your usefull library !
I have a question, I would like to get a 3x3 matrix from 4x4 matrix.

For example :

1, 0, 0, 2
0, 1, 0, 2
0, 0, 1, 2
0, 0, 0, 2

And get :

1, 0, 0
0, 1, 0
0, 0, 1

I tried to use UpperTriangle, but it returns the same matrix.
Indeed, in the source I found this :

var result = CreateMatrix(RowCount, ColumnCount);

And the same code in LowerTriangle too.

I have another question : is there a function to return the normal matrix 3x3 from a 4x4 matrix ? (For OpenGL computation).

Thank you for your help.
Regards

Coordinator
Oct 24, 2012 at 10:04 PM
  • It seems you just want a sub-matrix of the original one, i.e. "var b = a.SubMatrix(0,3,0,3)"
  • What is the "normal matrix" of another matrix? I understand that a matrix can be "normal" (iif A*A=AA*) or not, but that doesn't seem to be what you're looking for.

Thanks,
Christoph

Oct 26, 2012 at 9:15 AM
Edited Oct 26, 2012 at 9:16 AM

"var b = a.SubMatrix(0,3,0,3)" => Thank you, it's exactly what I want.

 

In 3D, a normal matrix is a matrix needed to transform normal vector of each vertex : normal matrix.

By the way, I didn't find any LookAt or Perspective method to create matrix. Do they exist ?

 

Thank you for your answers !

Oct 26, 2012 at 11:35 AM
Edited Oct 26, 2012 at 11:35 AM

I think you'd be better off with some code optimized for OpenGL. You could use the OpenTK matrix classes, for example (I do use them with SharpGL):

http://opentk.svn.sourceforge.net/viewvc/opentk/trunk/Source/OpenTK/Math/

They have the projection and modelview stuff built in.

Oct 26, 2012 at 11:38 AM

Thank you, it's exactly what I need !