Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #19077 > unrolled thread

BafflinTransform

Started bybob smith <bob@coolfone.comze.com>
First post2012-10-03 07:58 -0700
Last post2012-10-03 16:01 -0700
Articles 20 on this page of 28 — 10 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  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 1 of 2  [1] 2  Next page →


#19077 — BafflinTransform

Frombob smith <bob@coolfone.comze.com>
Date2012-10-03 07:58 -0700
SubjectBafflinTransform
Message-ID<a1dd4f88-2a80-4af5-8716-d356d9fb3852@googlegroups.com>
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?

[toc] | [next] | [standalone]


#19079

Frommarkspace <-@.>
Date2012-10-03 08:45 -0700
Message-ID<k4hmjn$c5t$1@dont-email.me>
In reply to#19077
On 10/3/2012 7:58 AM, bob smith wrote:
> 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?


I suspect some math is involved.  :-)


Seriously, it's matrix algebra, and the formulas are given in each 
method description.  You need to work out what it is you are actually 
doing first.  Which you haven't told us, so I'm assuming that's the problem.

[toc] | [prev] | [next] | [standalone]


#19080

FromLew <lewbloch@gmail.com>
Date2012-10-03 10:41 -0700
Message-ID<2b58f0f5-5415-47c4-baa7-bb798825cb29@googlegroups.com>
In reply to#19079
markspace wrote:
> bob smith wrote:
>> Am I the only one who gets incredibly confused by AffineTransform?

No, but that isn't necessarily a reflection on the class.

>> I never know when to preConcatenate or concatenate.  Then I try both
>> possibilities, and a lot of times neither one produces my desired
>> result.

http://sscce.org/

"Hey, doctor, I keep trying to get healthy. I've tried medicine and I've tried 
exercise, and neither one produces my desired result."

>> Any tips?

Ask smarter questions.
 
> I suspect some math is involved.  :-)
> 
> Seriously, it's matrix algebra, and the formulas are given in each 
> method description.  You need to work out what it is you are actually 
> doing first.  Which you haven't told us, so I'm assuming that's the problem.

So show us what you're trying to accomplish, what you've written as an SSCCE, and 
what precisely, with copied and pasted output, what differs from your precise 
expectations.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#19081

FromGene Wirchenko <genew@ocis.net>
Date2012-10-03 10:51 -0700
Message-ID<hguo68l319fan6jngo468c7sm6okmh54s0@4ax.com>
In reply to#19080
On Wed, 3 Oct 2012 10:41:15 -0700 (PDT), Lew <lewbloch@gmail.com>
wrote:

>markspace wrote:
>> bob smith wrote:
>>> Am I the only one who gets incredibly confused by AffineTransform?
>
>No, but that isn't necessarily a reflection on the class.
>
>>> I never know when to preConcatenate or concatenate.  Then I try both
>>> possibilities, and a lot of times neither one produces my desired
>>> result.
>
>http://sscce.org/
>
>"Hey, doctor, I keep trying to get healthy. I've tried medicine and I've tried 
>exercise, and neither one produces my desired result."
>
>>> Any tips?
>
>Ask smarter questions.

     Besides SSCCE, there is
          http://www.catb.org/~esr/faqs/smart-questions.html
          How To Ask Questions The Smart Way
          by Eric Steven Raymond
It discusses at length how to properly ask technical questions.

     The main benefit of following it is that people will have more,
relevant details and stand a better chance of knowing what you are
discussing and what might be done about.

     A quieter, but more powerful benefit, is that to ask a technical
question properly, you have to think about your problem in a
structured manner, and often, this can lead to you being able to solve
the problem yourself.

[snip]

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#19091

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-10-03 21:36 -0400
Message-ID<506ce82b$0$294$14726298@news.sunsite.dk>
In reply to#19080
On 10/3/2012 1:41 PM, Lew wrote:
> markspace wrote:
>> bob smith wrote:
>>> Am I the only one who gets incredibly confused by AffineTransform?
>
> No, but that isn't necessarily a reflection on the class.
>
>>> I never know when to preConcatenate or concatenate.  Then I try both
>>> possibilities, and a lot of times neither one produces my desired
>>> result.
>
> http://sscce.org/
>
> "Hey, doctor, I keep trying to get healthy. I've tried medicine and I've tried
> exercise, and neither one produces my desired result."
>
>>> Any tips?
>
> Ask smarter questions.
>
>> I suspect some math is involved.  :-)
>>
>> Seriously, it's matrix algebra, and the formulas are given in each
>> method description.  You need to work out what it is you are actually
>> doing first.  Which you haven't told us, so I'm assuming that's the problem.
>
> So show us what you're trying to accomplish, what you've written as an SSCCE, and
> what precisely, with copied and pasted output, what differs from your precise
> expectations.

Hm.

If the original poster has a limited number of specific
problems, then producing a SSCCE is a very good thing.

But I don't see any indications of that.

To me it seems as if the original poster in general find
it difficult to understand how to get it right (besides trial
and error).

It is not a SSCCE'able problem, because it is not about
specific code.

Instead it is about concepts and principles.

Arne


[toc] | [prev] | [next] | [standalone]


#19093

FromGene Wirchenko <genew@ocis.net>
Date2012-10-03 21:49 -0700
Message-ID<c85q68t1rh8q1ra7tahjjq59lndbektn72@4ax.com>
In reply to#19091
On Wed, 03 Oct 2012 21:36:38 -0400, Arne Vajhøj <arne@vajhoej.dk>
wrote:

[snip]

>Hm.
>
>If the original poster has a limited number of specific
>problems, then producing a SSCCE is a very good thing.
>
>But I don't see any indications of that.
>
>To me it seems as if the original poster in general find
>it difficult to understand how to get it right (besides trial
>and error).
>
>It is not a SSCCE'able problem, because it is not about
>specific code.
>
>Instead it is about concepts and principles.

     It is still SSCCE, just not in code.

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#19094

FromJeff Higgins <jeff@invalid.invalid>
Date2012-10-04 03:26 -0400
Message-ID<k4jddm$slq$1@dont-email.me>
In reply to#19091
On 10/03/2012 09:36 PM, Arne Vajhøj wrote:
>>> bob smith wrote:


> Hm.
>
> If the original poster has a limited number of specific
> problems, then producing a SSCCE is a very good thing.
>
> But I don't see any indications of that.
>
> To me it seems as if the original poster in general find
> it difficult to understand how to get it right (besides trial
> and error).
>

To me it seems rather the bob is conducting a poll or troll.
 >>>> Am I the only one who gets incredibly confused by AffineTransform?

> It is not a SSCCE'able problem, because it is not about
> specific code.
>
> Instead it is about concepts and principles.
>
> Arne
>
>
>

[toc] | [prev] | [next] | [standalone]


#19100

FromGene Wirchenko <genew@ocis.net>
Date2012-10-04 09:30 -0700
Message-ID<vaer68hj2iterhhjsb2jqfse9ru8o36ttb@4ax.com>
In reply to#19094
On Thu, 04 Oct 2012 03:26:41 -0400, Jeff Higgins
<jeff@invalid.invalid> wrote:

>On 10/03/2012 09:36 PM, Arne Vajhøj wrote:
>>>> bob smith wrote:

[snip]

>To me it seems rather the bob is conducting a poll or troll.
> >>>> Am I the only one who gets incredibly confused by AffineTransform?

     Oh, come off it.  Taking the literal meaning when it is rather
obviously not intended is silly.

[snip]

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#19110

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-10-04 17:38 -0400
Message-ID<506e01db$0$289$14726298@news.sunsite.dk>
In reply to#19094
On 10/4/2012 3:26 AM, Jeff Higgins wrote:
> To me it seems rather the bob is conducting a poll or troll.

Why?

Problems understanding that stuff is pretty common.

Arne


[toc] | [prev] | [next] | [standalone]


#19120

FromJeff Higgins <jeff@invalid.invalid>
Date2012-10-05 03:00 -0400
Message-ID<k4m08j$adh$1@dont-email.me>
In reply to#19110
On 10/04/2012 05:38 PM, Arne Vajhøj wrote:
> On 10/4/2012 3:26 AM, Jeff Higgins wrote:
>> To me it seems rather the bob is conducting a poll or troll.
>
> Why?
I don't know. It is just the way it read to me.
>
> Problems understanding that stuff is pretty common.
Yep. The original post didn't seem a sincere request for
enlightenment despite the final, "Any tips?".

[toc] | [prev] | [next] | [standalone]


#19165

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-10-05 22:02 -0400
Message-ID<506f913b$0$290$14726298@news.sunsite.dk>
In reply to#19120
On 10/5/2012 3:00 AM, Jeff Higgins wrote:
> On 10/04/2012 05:38 PM, Arne Vajhøj wrote:
>> On 10/4/2012 3:26 AM, Jeff Higgins wrote:
>>> To me it seems rather the bob is conducting a poll or troll.
>>
>> Why?
> I don't know. It is just the way it read to me.
>>
>> Problems understanding that stuff is pretty common.
> 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

[toc] | [prev] | [next] | [standalone]


#19105

FromLew <lewbloch@gmail.com>
Date2012-10-04 12:05 -0700
Message-ID<a0c44d5e-f7de-4a3f-a060-41945416df12@googlegroups.com>
In reply to#19091
Arne Vajhøj wrote:
> Lew wrote:
>>> bob smith wrote:
>>>> Am I the only one who gets incredibly confused by AffineTransform?
> 
>> No, but that isn't necessarily a reflection on the class.
> 
>>>> I never know when to preConcatenate or concatenate.  Then I try both
>>>> possibilities, and a lot of times neither one produces my desired
>>>> result.
> 
>> http://sscce.org/
>
. . .  
>> So show us what you're trying to accomplish, what you've written as an SSCCE, and
>> what precisely, with copied and pasted output, what differs from your precise
>> expectations.
> 
> Hm.
> 
> If the original poster has a limited number of specific
> problems, then producing a SSCCE is a very good thing.
> But I don't see any indications of that.

Then you missed what you quoted:

>>>> Then I try both possibilities, and a lot of times neither one produces my desired
>>>> result.

> To me it seems as if the original poster in general find
> it difficult to understand how to get it right (besides trial
> and error).
> 
> It is not a SSCCE'able problem, because it is not about
> specific code.
> 
> Instead it is about concepts and principles.

He mentioned specific code, but he didn't show it.

I asked him to show what he tried, as he claimed he'd tried it.

That's pretty damned specific.

 -- 
Lew

[toc] | [prev] | [next] | [standalone]


#19096

Frombob smith <bob@coolfone.comze.com>
Date2012-10-04 07:22 -0700
Message-ID<e69f5245-a51f-4547-9837-22f23ca838f2@googlegroups.com>
In reply to#19079
On Wednesday, October 3, 2012 10:46:00 AM UTC-5, markspace wrote:
> On 10/3/2012 7:58 AM, bob smith wrote:
> 
> > 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?
> 
> 
> 
> 
> 
> I suspect some math is involved.  :-)
> 
> 
> 
> 
> 
> Seriously, it's matrix algebra, and the formulas are given in each 
> 
> method description.  You need to work out what it is you are actually 
> 
> doing first.  Which you haven't told us, so I'm assuming that's the problem.

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.

What happened was I started with just translations and was concatenating.

Then, I added rotation, and it did not work right whether I preConcatenated or concatenated.  The issue was that I should have been preConcatenating the translations that I had already programmed in.

[toc] | [prev] | [next] | [standalone]


#19101

FromGene Wirchenko <genew@ocis.net>
Date2012-10-04 09:35 -0700
Message-ID<fder68l1c0etqevoaigdb3f09l4rp222l1@4ax.com>
In reply to#19096
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]

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#19102

From"John B. Matthews" <nospam@nospam.invalid>
Date2012-10-04 13:58 -0400
Message-ID<nospam-E2F47C.13581304102012@news.aioe.org>
In reply to#19101
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 
to think of a series of (post-) concatenated transformations as 
having been applied in a last-specified-first-applied order. In 
the example cited below, a small, U-shaped Polygon is centered 
about the origin. The following transform rotates, scales and 
translates the Polygon in the (apparent) reverse of program 
order:

    AffineTransform at = new AffineTransform();
    at.translate(SIZE/2, SIZE/2);
    at.scale(60, 60);
    at.rotate(Math.PI/4);

<https://sites.google.com/site/drjohnbmatthews/point-in-polygon>

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

[toc] | [prev] | [next] | [standalone]


#19103

Frommarkspace <-@.>
Date2012-10-04 11:44 -0700
Message-ID<k4kldp$g1q$1@dont-email.me>
In reply to#19102
On 10/4/2012 10:58 AM, John B. Matthews wrote:

 > In article <fder68l1c0etqevoaigdb3f09l4rp222l1@4ax.com>,
>>
>>       Matrix multiplication is NOT commutative.
>>
>>

> Absolutely correct, as well as pithy. Conceptually, it may help
> to think of a series of (post-) concatenated transformations as
> having been applied in a last-specified-first-applied order.


Another rule of thumb is that scaling and rotating tend to occur around 
the origin, not the translation point.  So if you scale or rotate an 
already-translated AffinceTransform, you might get unintended results.

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.

Given that AffineTransforms are 2D transforms, some results might be 
different than the 3D equivalents.  Like I said, some math might be 
involved here.

[toc] | [prev] | [next] | [standalone]


#19114

From"John B. Matthews" <nospam@nospam.invalid>
Date2012-10-04 21:23 -0400
Message-ID<nospam-E6C67B.21230604102012@news.aioe.org>
In reply to#19103
In article <k4kldp$g1q$1@dont-email.me>, markspace <-@.> wrote:

> On 10/4/2012 10:58 AM, John B. Matthews wrote:
> 
>  > In article <fder68l1c0etqevoaigdb3f09l4rp222l1@4ax.com>,
> >>
> >>       Matrix multiplication is NOT commutative.
> >>
> > Absolutely correct, as well as pithy. Conceptually, it may help
> > to think of a series of (post-) concatenated transformations as
> > having been applied in a last-specified-first-applied order.
> 

> Another rule of thumb is that scaling and rotating tend to occur 
> around the origin, not the translation point.  So if you scale or 
> rotate an already-translated AffinceTransform, you might get 
> unintended results.

Agree.
 
> 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.

Why not? Isn't that what a method like the anchored rotate() below does? 
When it returns, the enclosing transform contains a single matrix that 
does all three things when applied to a graphics context or used to 
create a transformed Shape.

  public void rotate(double theta, double anchorx, double anchory) {
    translate(anchorx, anchory);
    rotate(theta);
    translate(-anchorx, -anchory);
  }

> Given that AffineTransforms are 2D transforms, some results might be 
> different than the 3D equivalents.  Like I said, some math might be 
> involved here.

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

[toc] | [prev] | [next] | [standalone]


#19115

Frommarkspace <-@.>
Date2012-10-04 19:27 -0700
Message-ID<k4lgip$8mk$1@dont-email.me>
In reply to#19114
On 10/4/2012 6:23 PM, John B. Matthews wrote:

> In article <k4kldp$g1q$1@dont-email.me>, markspace <-@.> wrote:
>> you can't put all that together in one matrix.


> Why not? Isn't that what a method like the anchored rotate() below does?


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.

[toc] | [prev] | [next] | [standalone]


#19116

FromPeter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com>
Date2012-10-04 19:55 -0700
Message-ID<7hadgemrru4$.11pr11o2uzjhz.dlg@40tude.net>
In reply to#19115
On Thu, 04 Oct 2012 19:27:32 -0700, markspace wrote:

> On 10/4/2012 6:23 PM, John B. Matthews wrote:
> 
>> In article <k4kldp$g1q$1@dont-email.me>, markspace <-@.> wrote:
>>> you can't put all that together in one matrix.
> 
> 
>> Why not? Isn't that what a method like the anchored rotate() below does?
> 
> 
> 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.

Can you clarify what you mean?

Matrices can be multiplied together (or in the Java lingo, "concatenated"),
resulting in a single matrix.  Yes, you need to (barring some hairy math
that's not worth the trouble) start with a separate matrix for each
transform.  But they can be easily combined into a single matrix that can
then be used to perform the sequence of transformations as a single
transformation.

Your post seems to be saying that's not possible.

Pete

[toc] | [prev] | [next] | [standalone]


#19118

FromEric Sosman <esosman@ieee-dot-org.invalid>
Date2012-10-04 23:33 -0400
Message-ID<k4lkfe$pe8$1@dont-email.me>
In reply to#19115
On 10/4/2012 10:27 PM, markspace wrote:
> On 10/4/2012 6:23 PM, John B. Matthews wrote:
>
>> In article <k4kldp$g1q$1@dont-email.me>, markspace <-@.> wrote:
>>> you can't put all that together in one matrix.
>
>
>> Why not? Isn't that what a method like the anchored rotate() below does?
>
>
> 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?

-- 
Eric Sosman
esosman@ieee-dot-org.invalid

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.java.programmer


csiph-web