ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* MetaPost transformation
@ 2012-05-30 21:10 Troy Henderson
  2012-05-30 21:30 ` Hans Hagen
  2012-05-31  7:00 ` Albrecht Kauffmann
  0 siblings, 2 replies; 7+ messages in thread
From: Troy Henderson @ 2012-05-30 21:10 UTC (permalink / raw)
  To: MetaPost List, mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 817 bytes --]

I've encountered a MetaPost issue, and since many MetaPost users also use
ConTeXt (and vice-versa), I am posting this question on both lists.

The command

> show identity rotated 270 yscaled 0.5;

outputs

(0,0,0,1,-0.5,0)

as expected, while the command

> show identity transformed (0,0,0,1,-0.5,0);

errors with

---
! Missing `)' has been inserted.
<to be read again>
                   ,
l.26 ^^Ishow identity transformed (0,0,0,1,
                                           -0.5,0);
---

I am using MetaPost 1.504, and the problem seems to be that MetaPost does
not like me using the sextuple (0,0,0,1,-0.5,0) directly, but this is the
most convenient method for me to describe my transformations.  Is this a
bug in MetaPost, or am I not allowed to use transformations directly with
sextuples?

Troy Henderson

[-- Attachment #1.2: Type: text/html, Size: 927 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: MetaPost transformation
  2012-05-30 21:10 MetaPost transformation Troy Henderson
@ 2012-05-30 21:30 ` Hans Hagen
  2012-05-31  0:56   ` Troy Henderson
  2012-05-31  7:00 ` Albrecht Kauffmann
  1 sibling, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2012-05-30 21:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: MetaPost List

On 30-5-2012 23:10, Troy Henderson wrote:
> I've encountered a MetaPost issue, and since many MetaPost users also use
> ConTeXt (and vice-versa), I am posting this question on both lists.
>
> The command
>
>> show identity rotated 270 yscaled 0.5;
>
> outputs
>
> (0,0,0,1,-0.5,0)
>
> as expected, while the command
>
>> show identity transformed (0,0,0,1,-0.5,0);
>
> errors with
>
> ---
> ! Missing `)' has been inserted.
> <to be read again>
>                     ,
> l.26 ^^Ishow identity transformed (0,0,0,1,
>                                             -0.5,0);
> ---
>
> I am using MetaPost 1.504, and the problem seems to be that MetaPost does
> not like me using the sextuple (0,0,0,1,-0.5,0) directly, but this is the
> most convenient method for me to describe my transformations.  Is this a
> bug in MetaPost, or am I not allowed to use transformations directly with
> sextuples?

It looks like sextuples are no basic datatype. I think that the show is 
just a way to output the internal representation. Of course it would 
make sense to have sixtuples (I can even think of a generic n-tuple).

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: MetaPost transformation
  2012-05-30 21:30 ` Hans Hagen
@ 2012-05-31  0:56   ` Troy Henderson
       [not found]     ` <CAFP+xFJmoZ0PBWK=91SY7jPmEa_4gWGSBHfnt6S659jEiQCbAg@mail.g mail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Troy Henderson @ 2012-05-31  0:56 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users, MetaPost List


[-- Attachment #1.1: Type: text/plain, Size: 295 bytes --]

Well then in case anyone needs such a transformation, I've constructed the
(non-unique) transformation T

> t:=angle(f,e);
> q:=e++f;
> p:=(c*f-d*e)/q;
> s:=(c*e+d*f)/(q**2);
> transform T;
> T:=identity rotated t xscaled p yscaled q slanted s shifted (a,b);

This yields T=(a,b,c,d,e,f).

Troy

[-- Attachment #1.2: Type: text/html, Size: 363 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [NTG-context] MetaPost transformation
       [not found]     ` <CAFP+xFJmoZ0PBWK=91SY7jPmEa_4gWGSBHfnt6S659jEiQCbAg@mail.g mail.com>
@ 2012-05-31  2:37       ` Dan Luecking
  2012-05-31  3:44         ` [metapost] " Troy Henderson
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Luecking @ 2012-05-31  2:37 UTC (permalink / raw)
  To: Troy Henderson; +Cc: mailing list for ConTeXt users, MetaPost List

At 07:56 PM 5/30/2012, Troy Henderson wrote:
>Well then in case anyone needs such a transformation, I've 
>constructed the (non-unique) transformation T
>
> > t:=angle(f,e);
> > q:=e++f;
> > p:=(c*f-d*e)/q;
> > s:=(c*e+d*f)/(q**2);
> > transform T;
> > T:=identity rotated t xscaled p yscaled q slanted s shifted (a,b);
>
>This yields T=(a,b,c,d,e,f).

You can implement something like what you wanted directly
because, just as you can write equations for the parts of
a pair, you can also write equations for the parts of a
transform:
vardef mktransform (expr a,b,c,d,e,f) =
   save T_; transform T_;
   xpart  T_ = a;
   ypart  T_ = b;
   xxpart T_ = c;
   xypart T_ = d;
   yxpart T_ = e;
   yypart T_ = f;
   T_
enddef;

After this
   transform T;
   T := mktransform (1,2,3,4,5,6);
   show T;
produces:
 >> (1,2,3,4,5,6)

Regards,
Dan


Daniel H. Luecking
Department of Mathematical Sciences
Fayetteville, Arkansas
http://www-cs-faculty.stanford.edu/~knuth/iaq.html 

--
http://tug.org/metapost/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [metapost]  MetaPost transformation
  2012-05-31  2:37       ` [NTG-context] " Dan Luecking
@ 2012-05-31  3:44         ` Troy Henderson
  0 siblings, 0 replies; 7+ messages in thread
From: Troy Henderson @ 2012-05-31  3:44 UTC (permalink / raw)
  To: Dan Luecking; +Cc: mailing list for ConTeXt users, MetaPost List


[-- Attachment #1.1: Type: text/plain, Size: 62 bytes --]

Thanks Dan.  This is much better than what I was doing.

Troy

[-- Attachment #1.2: Type: text/html, Size: 73 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: MetaPost transformation
  2012-05-30 21:10 MetaPost transformation Troy Henderson
  2012-05-30 21:30 ` Hans Hagen
@ 2012-05-31  7:00 ` Albrecht Kauffmann
  2012-05-31 12:31   ` Troy Henderson
  1 sibling, 1 reply; 7+ messages in thread
From: Albrecht Kauffmann @ 2012-05-31  7:00 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: MetaPost List

Hello Troy,

if you declare a transform variable (e.g., t), it works:

transform t;
t := identity rotated 270 yscaled 0.5;
show identity transformed t;
>> (0,0,0,1,-0.5,0)

Greetings
Albrecht

On Wed, 30 May 2012, Troy Henderson wrote:

> I've encountered a MetaPost issue, and since many MetaPost users also use
> ConTeXt (and vice-versa), I am posting this question on both lists.
>
> The command
>
>> show identity rotated 270 yscaled 0.5;
>
> outputs
>
> (0,0,0,1,-0.5,0)
>
> as expected, while the command
>
>> show identity transformed (0,0,0,1,-0.5,0);
>
> errors with
>
> ---
> ! Missing `)' has been inserted.
> <to be read again>
>                   ,
> l.26 ^^Ishow identity transformed (0,0,0,1,
>                                           -0.5,0);
> ---
>
> I am using MetaPost 1.504, and the problem seems to be that MetaPost does
> not like me using the sextuple (0,0,0,1,-0.5,0) directly, but this is the
> most convenient method for me to describe my transformations.  Is this a
> bug in MetaPost, or am I not allowed to use transformations directly with
> sextuples?
>
> Troy Henderson
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: MetaPost transformation
  2012-05-31  7:00 ` Albrecht Kauffmann
@ 2012-05-31 12:31   ` Troy Henderson
  0 siblings, 0 replies; 7+ messages in thread
From: Troy Henderson @ 2012-05-31 12:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: MetaPost List


[-- Attachment #1.1: Type: text/plain, Size: 94 bytes --]

Albrecht,

The issue was to be able to define the transform t using its six components.

Troy

[-- Attachment #1.2: Type: text/html, Size: 110 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-05-31 12:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-30 21:10 MetaPost transformation Troy Henderson
2012-05-30 21:30 ` Hans Hagen
2012-05-31  0:56   ` Troy Henderson
     [not found]     ` <CAFP+xFJmoZ0PBWK=91SY7jPmEa_4gWGSBHfnt6S659jEiQCbAg@mail.g mail.com>
2012-05-31  2:37       ` [NTG-context] " Dan Luecking
2012-05-31  3:44         ` [metapost] " Troy Henderson
2012-05-31  7:00 ` Albrecht Kauffmann
2012-05-31 12:31   ` Troy Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).