BafflinTransform

E

Eric Sosman

What I was trying to say, and did say in fact, was that you cannot
multiply out the three steps into a single matrix. Which is exactly
what I quoted above. You apparently read "matrix" as "method" and
thought I was talking about something else.

Yes, you can easily make a single method. You still need a minimum of
three matrix operations to accomplish the goal, however.

Has somebody repealed the associative law?
 
G

Gene Wirchenko

[snip]
The method I'm used to from 3D graphics is to translate any objects back
to the origin, scale and rotate, then translate them back to their
original/intended point in space. It's a literal three step process;
you can't put all that together in one matrix.

Yes, you can. Start with an identity matrix and apply each of
the three transforms in succession. You now have one matrix which
does all three transforms in one step. Matrix multiplication is
associative so this does work.

[snip]

Sincerely,

Gene Wirchenko
 
M

markspace

[snip]
The method I'm used to from 3D graphics is to translate any objects back
to the origin, scale and rotate, then translate them back to their
original/intended point in space. It's a literal three step process;
you can't put all that together in one matrix.

Yes, you can. Start with an identity matrix and apply each of
the three transforms in succession. You now have one matrix which
does all three transforms in one step. Matrix multiplication is
associative so this does work.


No, really it doesn't work this way. Note I'm not talking about
starting with the identity matrix. I'm talking about starting with an
object that's already been translated at least once. You have to add an
extra step to remove the translations back to the origin ("identity") or
successive multiplications aren't going to work the way you'd expect.

And I don't think you can "pre-multiply" that out; you'll end up doing
four, or more, operations instead of three. In intensive graphics
applications, that's a no-no.
 
G

Gene Wirchenko

[snip]
No, really it doesn't work this way. Note I'm not talking about
starting with the identity matrix. I'm talking about starting with an
object that's already been translated at least once. You have to add an

You do not have to.
extra step to remove the translations back to the origin ("identity") or
successive multiplications aren't going to work the way you'd expect.

And I don't think you can "pre-multiply" that out; you'll end up doing
four, or more, operations instead of three. In intensive graphics
applications, that's a no-no.

Well, you can. Since matrix multiplication is associative, you
can do so. Example with right-side transforms:

Let M be whatever matrix you wish to transform.
Let M' be the transformed matrix.
Let T1 be the transform for translation to origin.
Let T2 be the main transform.
Let T3 be the transform for translation from origin.

M' = M X T1 X T2 X T3
is equivalent to
M' = M X (T1 X T2 X T3)
Now, let Tall = T1 X T2 X T3. Obviously,
M' = M X Tall
You can apply Tall to however many matrices as you want, but you need
calculate it only once.

Sincerely,

Gene Wirchenko
 
M

markspace

Well, you can. Since matrix multiplication is associative, you
can do so. Example with right-side transforms:

Since the translation part has to happen first and last, I don't think
this helps. Association isn't the issue, it's commutation.

F = T1 x S x A x T2

A is constant, S (start) is your input, T1 translates back to the
origin, and T2 translates back. F is the final output. T1 and T2 are
"variable" in that they are related to S and will be different for each
pass. I think T2 = the total translation on the S object, and T1 =
1/T2, but I haven't double checked/proved that mathematically.

If you try to combine A x T2, you don't save any work, because it still
has to be done once per S rotated.

I've seen this formula a lot in many books, and if there were a way to
simplify it, I'm sure someone would have by now. Plus, math.

Let me try to give a quick example. We have a shape which looks like
the letter X, which we want to rotate 45 degrees counter clockwise about
it's own center, so we are looking at an X that is slightly heeled over.
The X is currently at position (1,2), so if we just applied a
rotation, we'd actually rotate the (1,2) about the origin we don't want
that.

^
|
|. . .X
| .
|------------->

To do this we must translate back to the origin, apply the transform,
and then translation back to (1,2). Now imagine we have several hundred
other shapes to rotate/scale the same way. I think that makes clear the
operation I'm talking about. Many shapes all with a *local* transform
which need to be applied, most not at the origin. I don't think you can
reduce that formula in the general case.
 
A

Arne Vajhøj

I don't know. It is just the way it read to me.
Yep. The original post didn't seem a sincere request for
enlightenment despite the final, "Any tips?".

You may be right.

But I am willing to give the guy the benefit of
doubt.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top