Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #19077 > unrolled thread
| Started by | bob smith <bob@coolfone.comze.com> |
|---|---|
| First post | 2012-10-03 07:58 -0700 |
| Last post | 2012-10-03 16:01 -0700 |
| Articles | 8 on this page of 28 — 10 participants |
Back to article view | Back to comp.lang.java.programmer
BafflinTransform bob smith <bob@coolfone.comze.com> - 2012-10-03 07:58 -0700
Re: BafflinTransform markspace <-@.> - 2012-10-03 08:45 -0700
Re: BafflinTransform Lew <lewbloch@gmail.com> - 2012-10-03 10:41 -0700
Re: BafflinTransform Gene Wirchenko <genew@ocis.net> - 2012-10-03 10:51 -0700
Re: BafflinTransform Arne Vajhøj <arne@vajhoej.dk> - 2012-10-03 21:36 -0400
Re: BafflinTransform Gene Wirchenko <genew@ocis.net> - 2012-10-03 21:49 -0700
Re: BafflinTransform Jeff Higgins <jeff@invalid.invalid> - 2012-10-04 03:26 -0400
Re: BafflinTransform Gene Wirchenko <genew@ocis.net> - 2012-10-04 09:30 -0700
Re: BafflinTransform Arne Vajhøj <arne@vajhoej.dk> - 2012-10-04 17:38 -0400
Re: BafflinTransform Jeff Higgins <jeff@invalid.invalid> - 2012-10-05 03:00 -0400
Re: BafflinTransform Arne Vajhøj <arne@vajhoej.dk> - 2012-10-05 22:02 -0400
Re: BafflinTransform Lew <lewbloch@gmail.com> - 2012-10-04 12:05 -0700
Re: BafflinTransform bob smith <bob@coolfone.comze.com> - 2012-10-04 07:22 -0700
Re: BafflinTransform Gene Wirchenko <genew@ocis.net> - 2012-10-04 09:35 -0700
Re: BafflinTransform "John B. Matthews" <nospam@nospam.invalid> - 2012-10-04 13:58 -0400
Re: BafflinTransform markspace <-@.> - 2012-10-04 11:44 -0700
Re: BafflinTransform "John B. Matthews" <nospam@nospam.invalid> - 2012-10-04 21:23 -0400
Re: BafflinTransform markspace <-@.> - 2012-10-04 19:27 -0700
Re: BafflinTransform Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-10-04 19:55 -0700
Re: BafflinTransform Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-10-04 23:33 -0400
Re: BafflinTransform Gene Wirchenko <genew@ocis.net> - 2012-10-05 09:04 -0700
Re: BafflinTransform markspace <-@.> - 2012-10-05 09:34 -0700
Re: BafflinTransform Gene Wirchenko <genew@ocis.net> - 2012-10-05 12:58 -0700
Re: BafflinTransform markspace <-@.> - 2012-10-05 17:15 -0700
Re: BafflinTransform Gene Wirchenko <genew@ocis.net> - 2012-10-04 13:51 -0700
Re: BafflinTransform Jeff Higgins <jeff@invalid.invalid> - 2012-10-03 15:15 -0400
Re: BafflinTransform Lew <lewbloch@gmail.com> - 2012-10-03 12:49 -0700
Re: BafflinTransform Roedy Green <see_website@mindprod.com.invalid> - 2012-10-03 16:01 -0700
Page 2 of 2 — ← Prev page 1 [2]
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Date | 2012-10-05 09:04 -0700 |
| Message-ID | <s01u6890vvjd3nkvpq3qass17urqvucreh@4ax.com> |
| In reply to | #19103 |
On Thu, 04 Oct 2012 11:44:05 -0700, markspace <-@.> wrote:
[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
[toc] | [prev] | [next] | [standalone]
| From | markspace <-@.> |
|---|---|
| Date | 2012-10-05 09:34 -0700 |
| Message-ID | <k4n26t$icq$1@dont-email.me> |
| In reply to | #19126 |
On 10/5/2012 9:04 AM, Gene Wirchenko wrote:
> On Thu, 04 Oct 2012 11:44:05 -0700, markspace <-@.> wrote:
>
> [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.
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Date | 2012-10-05 12:58 -0700 |
| Message-ID | <dfeu68h4ruc2l8pn5s99r3sirii50hnnl5@4ax.com> |
| In reply to | #19127 |
On Fri, 05 Oct 2012 09:34:33 -0700, markspace <-@.> wrote:
[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
[toc] | [prev] | [next] | [standalone]
| From | markspace <-@.> |
|---|---|
| Date | 2012-10-05 17:15 -0700 |
| Message-ID | <k4nt6u$1vo$1@dont-email.me> |
| In reply to | #19146 |
On 10/5/2012 12:58 PM, Gene Wirchenko wrote: > > 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.
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Date | 2012-10-04 13:51 -0700 |
| Message-ID | <4gtr68tl158t8f0dgropkumgbme887vphr@4ax.com> |
| In reply to | #19102 |
On Thu, 04 Oct 2012 13:58:13 -0400, "John B. Matthews"
<nospam@nospam.invalid> wrote:
>In article <fder68l1c0etqevoaigdb3f09l4rp222l1@4ax.com>,
> Gene Wirchenko <genew@ocis.net> wrote:
>
>> On Thu, 4 Oct 2012 07:22:30 -0700 (PDT), bob smith
>> <bob@coolfone.comze.com> wrote:
>>
>> [snip]
>>
>> > It seems like when I want to "tack on" an operation, it is
>> > actually a preConcatenate.
>> >
>> > This is counterintuitive to me.
>> >
>> > Also, when you are just doing commutative operations,
>> > like just translation, it doesn't matter whether you
>> > preConcatenate or concatenate.
>>
>> Matrix multiplication is NOT commutative.
>>
>> [snip]
>
>Absolutely correct, as well as pithy. Conceptually, it may help
Yes to the first, because I did not say much. I did not intend
the pithy. I took one course that dealt with graphics
transformations. The material was not covered as well as it could
have been. Preferring not to misstate, I kept my statement short.
Maybe, OP is going through what I did. I think he might benefit
from some study of matrix algebra.
[snip]
Sincerely,
Gene Wirchenko
[toc] | [prev] | [next] | [standalone]
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Date | 2012-10-03 15:15 -0400 |
| Message-ID | <k4i2j1$u1$1@dont-email.me> |
| In reply to | #19077 |
On 10/03/2012 10:58 AM, bob smith wrote: > Am I the only one who gets incredibly confused by AffineTransform? According to the docs: concatenate [this] = [this] x [Tx] preconcatenate [this] = [Tx] x [this] > > I never know when to preConcatenate or concatenate. Then I try both possibilities, and a lot of times neither one produces my desired result. > > Any tips?
[toc] | [prev] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2012-10-03 12:49 -0700 |
| Message-ID | <98180187-7e3c-49ef-9584-b52c4353a31d@googlegroups.com> |
| In reply to | #19082 |
Jeff Higgins wrote: > bob smith wrote: >> Am I the only one who gets incredibly confused by AffineTransform? > > According to the docs: > concatenate [this] = [this] x [Tx] <http://docs.oracle.com/javase/7/docs/api/java/awt/geom/AffineTransform.html#concatenate(java.awt.geom.AffineTransform)> > preconcatenate [this] = [Tx] x [this] <http://docs.oracle.com/javase/7/docs/api/java/awt/geom/AffineTransform.html#preConcatenate(java.awt.geom.AffineTransform)> >> I never know when to preConcatenate or concatenate. Then I try both possibilities, >> and a lot of times neither one produces my desired result. If neither produces the desired result, then it isn't the choice of method that is the problem. >> Any tips? -- Lew Build a man a fire and you warm him for an hour. Set a man on fire and you warm him for the rest of his life.
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2012-10-03 16:01 -0700 |
| Message-ID | <6tgp68pmf1ac9adqtq7ut661cg86jgkto4@4ax.com> |
| In reply to | #19077 |
On Wed, 3 Oct 2012 07:58:04 -0700 (PDT), bob smith <bob@coolfone.comze.com> wrote, quoted or indirectly quoted someone who said : >Am I the only one who gets incredibly confused by AffineTransform? > >I never know when to preConcatenate or concatenate. Then I try both possibilities, and a lot of times neither one produces my desired result. > >Any tips? see http://mindprod.com/jgloss/affinetransform.html It has been a while since I wrote it, but it might help. -- Roedy Green Canadian Mind Products http://mindprod.com The iPhone 5 is a low end Rolex.
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.java.programmer
csiph-web