Subject:
|
Re: Inverse matrix?
|
Newsgroups:
|
lugnet.cad.ray, lugnet.cad
|
Date:
|
Sat, 7 Apr 2007 23:19:58 GMT
|
Viewed:
|
605 times
|
| |
| |
> > Does anyone know how to generate an inverse matrix. By inverse I
> > mean it will
> > undo the rotation of the original matrix. I thought the inverse of
> > <1,0,0,0,1,0,0,0,1,0,0,0> was <-1,0,0,0,-1,0,0,0,-1,0,0,0>. In
> > other words,
> > multiply every value by -1.
> >
> > I know POV-Ray 3.6 has an inverse matrix function but it doesn't
> > work in 3.1,
> > which is what I'm using.
>
> The inverse of <1,0,0,0,1,0,0,0,1,0,0,0> is itself.
>
> To compute the inverse of a general 3x3 matrix (essentially what
> you need to do)
> is rather complicated. You could do it in a macro using Gaussian
> elimination
Arg. I thought this was going to be easy. I liked this part of the
wikipedia article:
"In practice, inverting a matrix is rarely required. Most of the
time, one is really after the solution of a particular system of
linear equations."
Hm. I wonder which one I am after!
Maybe you guys can help. Here is what I'm doing. I'm using 3 points
in LDraw to represent a location, a lookat, and an up. If you are
familiar with POV-Ray's camera setup, this will make perfect sense.
And it works perfectly for camera. However, I also want to use it
for models. [I know I could just rotate the LDraw model to the
desired rotation, but I'm using these points as keyframes.] To do
the models I'm converting the points to a matrix using this code:
#macro rotation_matrix_for_loc_lookat_up(vectorLoc, vectorLookat,
vectorUp)
#local vectorD1=vnormalize(vectorLoc-vectorLookat); // direction of
view
#local vectorR1=vnormalize(vcross(vectorUp-vectorLoc,vectorD1)); //
to the right
#local vectorU1=vnormalize(vcross(vectorD1,vectorR1)); // up
array[12] {
vectorR1.x, vectorR1.y, vectorR1.z,
vectorU1.x, vectorU1.y, vectorU1.z,
vectorD1.x, vectorD1.y, vectorD1.z,
vectorLoc.x, vectorLoc.y, vectorLoc.z
}
#end
This way I have a matrix that will rotate any object using a lookat
and up.
However, I'm trying to use these points to construct a walking motion
so I have at least 3 points for a model all in world coordinates. To
figure out the rotations of the model's legs I need to convert these
to the model's local coordinates. To move the points to local model
coordinates I just have to subtract the model location from all the
points. But now I have to undo the world rotation. I'm stumped.
I've tried tons of stuff and I thought this wouldn't be so hard and
quite frankly this math is a bit over my head.
I'm sure I can do this using "a particular system of linear
equations", but I honestly don't know which. I've tried many
different things but nothing gets me the results I need.
Does anyone have any ideas?
James
|
|
Message has 1 Reply: | | Re: Inverse matrix?
|
| Clarification! .... snip (...) I am using additional points to specify the location of feet. Combined with the model location, I have 3 points for the hip and feet. [now the following paragraph should make more sense] (...) (18 years ago, 7-Apr-07, to lugnet.cad.ray, lugnet.cad)
|
Message is in Reply To:
| | Re: Inverse matrix?
|
| (...) The inverse of <1,0,0,0,1,0,0,0,1,0,0,0> is itself. To compute the inverse of a general 3x3 matrix (essentially what you need to do) is rather complicated. You could do it in a macro using Gaussian elimination [1]. Tim [1] (URL) (18 years ago, 7-Apr-07, to lugnet.cad.ray, lugnet.cad)
|
13 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
|
|
|
|