ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* z0---z1---z2---z3---cycle strange effect
@ 2007-06-04 23:05 David Arnold
  2007-06-14  8:59 ` Mojca Miklavec
  0 siblings, 1 reply; 5+ messages in thread
From: David Arnold @ 2007-06-04 23:05 UTC (permalink / raw)
  To: Context Mailing List List

All,

In working through the beginning chapters of the metafun manual, I am  
getting a very unusual effect when I open the resulting pdf file in  
Preview on Mac OS X. Here's a snapshot of what I see.

http://online.redwoods.edu/instruct/darnold/context/meta.gif

In acrobat, it looks fine.

http://online.redwoods.edu/instruct/darnold/context/meta.pdf

Any thoughts?

\setuppapersize[S6][S6]

\usetypescriptonce [map]      [times,helvetica,palatino] [texnansi]
\usetypescriptonce [serif]    [times]                    [name,texnansi]
\usetypescriptonce [sans]     [helvetica]                [name,texnansi]
\usetypescriptonce [palatino] [texnansi]

\setupbodyfont [palatino,10pt]

\startbuffer[mpenv]
\startMPenvironment
   \usetypescriptonce[map][times,helvetica,palatino][texnansi]
   \usetypescriptonce[serif][times][name,texnansi]
   \usetypescriptonce[sans][helvetica][name,texnansi]
   \usetypescriptonce[palatino][texnansi]
   \setupbodyfont[palatino,10pt]
   \definefont[RotFont][RegularBold]
\stopMPenvironment
\stopbuffer

\definefont[RotFont][RegularBold]

\getbuffer[mpenv]

\setupcolors[state=start]

\starttext

\startuseMPgraphic{axis}
   tickstep := 1cm ; ticklength := 2mm ;
   drawticks unitsquare xscaled 8cm yscaled 3cm ;
   tickstep := tickstep/2 ; ticklength := ticklength/2 ;
   drawticks unitsquare xscaled 8cm yscaled 3cm ;
\stopuseMPgraphic

\startuseMPgraphic{points}
   z0 = (0.5cm,1.5cm) ; z1 = (2.5cm,2.5cm) ;
   z2 = (6.5cm,0.5cm) ; z3 = (2.5cm,1.5cm) ;
\stopuseMPgraphic

\startuseMPgraphic{path}
   str := "z0---z1---z2---z3---cycle" ;
\stopuseMPgraphic

\startbuffer
\startlinecorrection[blank]
\startMPcode
   string str ; defaultfont := "\truefontname{Mono}" ;
   \includeMPgraphic{axis}
   \includeMPgraphic{points}
   \includeMPgraphic{path}
   label.lft(str,(14.5cm,2.5cm)) ;
   drawwholepath scantokens(str) ;
\stopMPcode
\stoplinecorrection
\stopbuffer

\getbuffer


\stoptext
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: z0---z1---z2---z3---cycle strange effect
  2007-06-04 23:05 z0---z1---z2---z3---cycle strange effect David Arnold
@ 2007-06-14  8:59 ` Mojca Miklavec
  2007-06-14  9:04   ` Mojca Miklavec
  2007-06-14  9:24   ` Taco Hoekwater
  0 siblings, 2 replies; 5+ messages in thread
From: Mojca Miklavec @ 2007-06-14  8:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Taco Hoekwater

On 6/5/07, David Arnold wrote:
> All,
>
> In working through the beginning chapters of the metafun manual, I am
> getting a very unusual effect when I open the resulting pdf file in
> Preview on Mac OS X. Here's a snapshot of what I see.
>
> http://online.redwoods.edu/instruct/darnold/context/meta.gif
>
> In acrobat, it looks fine.
>
> http://online.redwoods.edu/instruct/darnold/context/meta.pdf
>
> Any thoughts?

Hello,

It all boils down to

\starttext
\startMPcode

z0 = (0.5cm,1.5cm) ; z1 = (2.5cm,2.5cm) ;
z2 = (6.5cm,0.5cm) ; z3 = (2.5cm,1.5cm) ;

draw z0---z1---z2---z3---cycle withpen pencircle scaled 5pt;

\stopMPcode
\stoptext

resulting in

newpath
14.17323 42.51968 moveto
14.17139 42.52553 70.85913 70.86505 70.86613 70.86613 curveto
70.88313 70.86877 184.25645 14.18352 184.25194 14.17323 curveto
184.2461 14.15994 70.87599 42.51889 70.86613 42.51968 cureveto
70.86118 42.52008 14.17513 42.5137 14.17323 42.51968 curveto
closepath

If you ask me, this looks pretty much like a rendering bug in Mac's
Preview (if anyone bothers about that, please do that), but on the
other hand metapost could have generated a shorter & cleaner output as
well:

newpath
14.17323 42.51968 moveto
70.86613 70.86613 lineto
184.25194 14.17323 lineto
70.86613 42.51968 lineto
14.17323 42.51968 lineto
closepath

I suspect that the problem lies in control points of bezier curve
which are way too close to original points and thus lead to problems
with numerical precision, but I didn't experiment much deeper, so my
assumption might be wrong.

Taco?


Mojca

PS: I'm using mp 0.993 from TeXLive, but Supelec was down, so I wasn't
able to try it with the latest metapost version.


> \setuppapersize[S6][S6]
>
> \usetypescriptonce [map]      [times,helvetica,palatino] [texnansi]
> \usetypescriptonce [serif]    [times]                    [name,texnansi]
> \usetypescriptonce [sans]     [helvetica]                [name,texnansi]
> \usetypescriptonce [palatino] [texnansi]
>
> \setupbodyfont [palatino,10pt]
>
> \startbuffer[mpenv]
> \startMPenvironment
>    \usetypescriptonce[map][times,helvetica,palatino][texnansi]
>    \usetypescriptonce[serif][times][name,texnansi]
>    \usetypescriptonce[sans][helvetica][name,texnansi]
>    \usetypescriptonce[palatino][texnansi]
>    \setupbodyfont[palatino,10pt]
>    \definefont[RotFont][RegularBold]
> \stopMPenvironment
> \stopbuffer
>
> \definefont[RotFont][RegularBold]
>
> \getbuffer[mpenv]
>
> \setupcolors[state=start]
>
> \starttext
>
> \startuseMPgraphic{axis}
>    tickstep := 1cm ; ticklength := 2mm ;
>    drawticks unitsquare xscaled 8cm yscaled 3cm ;
>    tickstep := tickstep/2 ; ticklength := ticklength/2 ;
>    drawticks unitsquare xscaled 8cm yscaled 3cm ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{points}
>    z0 = (0.5cm,1.5cm) ; z1 = (2.5cm,2.5cm) ;
>    z2 = (6.5cm,0.5cm) ; z3 = (2.5cm,1.5cm) ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{path}
>    str := "z0---z1---z2---z3---cycle" ;
> \stopuseMPgraphic
>
> \startbuffer
> \startlinecorrection[blank]
> \startMPcode
>    string str ; defaultfont := "\truefontname{Mono}" ;
>    \includeMPgraphic{axis}
>    \includeMPgraphic{points}
>    \includeMPgraphic{path}
>    label.lft(str,(14.5cm,2.5cm)) ;
>    drawwholepath scantokens(str) ;
> \stopMPcode
> \stoplinecorrection
> \stopbuffer
>
> \getbuffer
>
>
> \stoptext
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: z0---z1---z2---z3---cycle strange effect
  2007-06-14  8:59 ` Mojca Miklavec
@ 2007-06-14  9:04   ` Mojca Miklavec
  2007-06-14 11:03     ` Alan Bowen
  2007-06-14  9:24   ` Taco Hoekwater
  1 sibling, 1 reply; 5+ messages in thread
From: Mojca Miklavec @ 2007-06-14  9:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 6/14/07, Mojca Miklavec wrote:

> If you ask me, this looks pretty much like a rendering bug in Mac's
> Preview (if anyone bothers about that, please do that),

Sorry for a weird sentence (I deleted part of it and forgot to fix the
rest) - I meant "if anyone bothers about reporting the problem to
Apple (and if it hasn't been reported or fixed yet), plese do that".
Preview has many other problems as well (no support for gouraud
shading etc.).

Mojca
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: z0---z1---z2---z3---cycle strange effect
  2007-06-14  8:59 ` Mojca Miklavec
  2007-06-14  9:04   ` Mojca Miklavec
@ 2007-06-14  9:24   ` Taco Hoekwater
  1 sibling, 0 replies; 5+ messages in thread
From: Taco Hoekwater @ 2007-06-14  9:24 UTC (permalink / raw)
  To: Mojca Miklavec; +Cc: mailing list for ConTeXt users



Mojca Miklavec wrote:
> draw z0---z1---z2---z3---cycle withpen pencircle scaled 5pt;
> 
> resulting in
> 
> newpath
> 14.17323 42.51968 moveto
> 14.17139 42.52553 70.85913 70.86505 70.86613 70.86613 curveto
> 70.88313 70.86877 184.25645 14.18352 184.25194 14.17323 curveto
> 184.2461 14.15994 70.87599 42.51889 70.86613 42.51968 cureveto
> 70.86118 42.52008 14.17513 42.5137 14.17323 42.51968 curveto
> closepath
> 
> If you ask me, this looks pretty much like a rendering bug in Mac's
> Preview (if anyone bothers about that, please do that), 

agree

> but on the
> other hand metapost could have generated a shorter & cleaner output as
> well:
> 
> newpath
> 14.17323 42.51968 moveto
> 70.86613 70.86613 lineto
> 184.25194 14.17323 lineto
> 70.86613 42.51968 lineto
> 14.17323 42.51968 lineto
> closepath

It would have done that, if the input would have been:

   draw z0--z1--z2--z3--cycle withpen pencircle scaled 5pt;

Small differences like this should not be removed automatically, in
my opinion, as they will be visible if the image is to be printed
as a poster (A0 format).

> I suspect that the problem lies in control points of bezier curve
> which are way too close to original points and thus lead to problems
> with numerical precision, but I didn't experiment much deeper, so my
> assumption might be wrong.

Almost certainly, but rounding errors are not an excuse for obviously
incorrect rendering.

Best wishes, Taco

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: z0---z1---z2---z3---cycle strange effect
  2007-06-14  9:04   ` Mojca Miklavec
@ 2007-06-14 11:03     ` Alan Bowen
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Bowen @ 2007-06-14 11:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Jun 14, 2007, at 5:04 AM, Mojca Miklavec wrote:

> On 6/14/07, Mojca Miklavec wrote:
>
>> If you ask me, this looks pretty much like a rendering bug in Mac's
>> Preview (if anyone bothers about that, please do that),
>
> Sorry for a weird sentence (I deleted part of it and forgot to fix the
> rest) - I meant "if anyone bothers about reporting the problem to
> Apple (and if it hasn't been reported or fixed yet), plese do that".
> Preview has many other problems as well (no support for gouraud
> shading etc.).
>
> Mojca
> ______________________________________________________________________ 
> _____________
> 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  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ______________________________________________________________________ 
> _____________

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2007-06-14 11:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-04 23:05 z0---z1---z2---z3---cycle strange effect David Arnold
2007-06-14  8:59 ` Mojca Miklavec
2007-06-14  9:04   ` Mojca Miklavec
2007-06-14 11:03     ` Alan Bowen
2007-06-14  9:24   ` Taco Hoekwater

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