Subject:
|
Re: Another matrix inverse question
|
Newsgroups:
|
lugnet.cad
|
Date:
|
Tue, 10 Apr 2007 11:00:44 GMT
|
Viewed:
|
1911 times
|
| |
| |
In lugnet.cad, Travis Cobbs wrote:
> In lugnet.cad, Ross Crawford wrote:
> > In lugnet.cad, Brian Durney wrote:
> > I think you've converted Travis' code properly, but just looking at the code,
> > I'd say it's only intended to produce the inverse of the upper-left 3x3 matrix.
> > None of the other rows or the determinant depend in any way on the 4th row, and
> > it's calculation doesn't include the determinant at all. I'd say the 4th row may
> > be used by Travis for some other purpose, maybe some scaling factor or
> > something, but I'd have to wade through the rest of the LDview source to confirm
> > that.
> >
> > So although you're using 4x4 matrices, you're only determining the inverse of
> > the upper-left 3x3 block. You can probably delete the chunks referring to the
> > 4th row & column and use 3x3 matrices.
>
> Sorry about that. I wrote that code so long ago that I forgot that it wasn't a
> fully general-purpose matrix inversion routine. (Note that it is the way it is
> so that it will perform better, not because I was too lazy to do the whole
> shebang.) And while I do believe that Ross is correct that the upper left 3x3
> does get a true inverse, it also does update the "translation" portion of the
> matrix (first three rows of the fourth column). It just assumes that the matrix
> will be a standard 3D transformation matrix in which the first three cells in
> the last row are 0.0 and the last cell is 1.0.
>
> As long as the matrix is composed entirely of rotate, translate and scale
> operations, it works, so if you're using the code for 3D work, then it's
> probably still fine. It just takes more work to set up your test cases for
> verification.
>
> Note: the first 4 entries in the array make up the first column, then next 4
> make up the second column, and so on. So offsets 12, 13, and 14 contain the
> translation portion of the 3D transformation matrix. Offsets 3, 7, and 11 are
> expected to be 0.0 (and are set to 0.0 in the output). Offset 15 is expected to
> be 1.0 (and is set to 1.0 in the output). I'm pretty sure you can't just fill
> in any arbitrary values to the 3x4 (rows x cols) matrix and have it work either.
> The values have to be arrived at via any number of rotations, translations, and
> scales (in any order). I don't remember the specifics of the algorithm, either.
> I see that I don't use the determinant when calculating the new values for the
> translation cells. I can't remember why I do that.
>
> --Travis
Hi Travis,
Looking at the java version of your inversion routine I would guess that it will
work for almost any 3x3 matrix + 1x3 translation (the 4x3 + 1 form). Where it
will have problems is in matrices for which one or more of the eigenvalues is
close to zero which is an unlikely situation in graphics but one that could
arise by compressing one axis down to almost planar.
It might be worth adding a more robust routine for use in that situation,
utilising Gauss-Jordan elmination or similar. It's easy to detect (is
abs(det)<eps) and would add one extra very minor conditional to the routine
under ordinary circumstances. YMMV however.
Tim
|
|
Message has 1 Reply: | | Re: Another matrix inverse question
|
| Thanks for the information, everyone. Although the test case I posted was arbitrary, I did some other tests with matrices that were used for rotations and translations. The upper-left 3x3 seemed to be OK, but the bottom row had problems. I'm (...) (18 years ago, 10-Apr-07, to lugnet.cad)
|
Message is in Reply To:
| | Re: Another matrix inverse question
|
| (...) Sorry about that. I wrote that code so long ago that I forgot that it wasn't a fully general-purpose matrix inversion routine. (Note that it is the way it is so that it will perform better, not because I was too lazy to do the whole shebang.) (...) (18 years ago, 10-Apr-07, to lugnet.cad)
|
12 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|