0

I want to analyze the each component of my 4*4 ModelView Matrix.

I came to know that the starting 3*3 of ModelView Matrix stores rotation. enter image description here

If i want my object to have no rotation with respect to camera so My ModelView Matrix looks like this

enter image description here

How to change my ModelView Matrix if i want to have NO Translation or Scaling ? Can anyone explain the Maths behind this.

user6250837
  • 458
  • 2
  • 21

2 Answers2

2

The upper left 3×3 defines the base vectors of a coordinate system. It's not just rotation but also scaling, shearing and similar stuff. Imagine three rubber legs which you can stretch and angle into any direction. This is what the upper left 3×3 does. If you want to rotate a coordinate system, you rotate the tree legs labeled X, Y, Z each into the direction you want to denote by that moniker in the other coordinate system. If you want to scale things, you stretch each leg. If you make them nonperpendicular things get sheared. That's really all there is to it.

However because everything (except translation) is intermingled in that upper left 3×3 part it's not trivial to "extract" the individual transformations from it. The rough steps to follow are:

  1. Major axis transform by the Principal axis theorem to find the major axis of any anisotropic scaling that may have been applied.
  2. decomposition into shearing and rotation parts.

Translation happens to sit in the rightmost column. The lowermost row must be [0 0 0 1] so that the stuff happening in the rows above it work in the desired way.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • Actuall i trying to solve this problem http://stackoverflow.com/questions/39814688/rotating-an-object-around-an-axis?noredirect=1#comment66921299_39814688 – user6250837 Oct 02 '16 at 14:46
1

The question is a bit more difficult than you realise. Whilst it is true that we can identify elements of the matrix as contributing to x axis scale, y axis scale, rotation, translation and so on, as transforms are iteratively applied, these get mixed up. To get the components back, you have to do a QRT decomposition of the matrix, which will be a bit beyond your level (not much, but it's not something you can expect to understand whilst your basic understanding of matrices is still a bit shaky).

Malcolm McLean
  • 6,258
  • 1
  • 17
  • 18