ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Curiouslearn <curiouslearn@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Metapost - Seems like weird behavior. Is it a bug?
Date: Tue, 24 Nov 2009 23:45:42 -0500	[thread overview]
Message-ID: <3b4b12310911242045l29326562t10e13387ce56b2cb@mail.gmail.com> (raw)

The code below shows a cyclic path that I am interested in creating
(it is in red if you run the code). The example works fine as long as
I have, u:=1cm, as in the code below. But if I replace it by ,
u:=0.6cm, there is no output. There is an error saying that paths 4
and 3 do not intersect. Is this a bug?

Thanks for your help.

\setuppapersize[letter][letter]
\setuplayout[leftedge=0in,leftmargin=1in,leftmargindistance=0in,rightmargin=1in,rightmargindistance=0in,rightedge=0in,leftedgedistance=0in,rightedgedistance=0in,topspace=0.5in,width=6.5in,height=10in]

\setupcolors[state=start]


\starttext

\startuseMPgraphic{buildS22}
	numeric u;
	u := 1cm;
	w:= 2pt;
	path xaxis; path yaxis;
	xaxis := (0,0)--(12,0) scaled u;
	yaxis := (0,0)--(0,12) scaled u;
	path stLine;
	path Curve;
	stLine :=
			function (1,"x","10-x",0,10,1) scaled u;
	Curve :=
			function(1,"x","2+8/x",1,10,0.1) scaled u;
	drawarrow xaxis withpen pencircle scaled w;
	drawarrow yaxis	withpen pencircle scaled w;	
	draw stLine withpen pencircle scaled w withcolor 0.5red;
	draw Curve withpen pencircle scaled w withcolor 0.5green;
	pair Lint[];
	Lint[1]:=yaxis intersectionpoint stLine;
	Lint[2]:=stLine intersectionpoint Curve;
	Lint[3]:=reverse stLine intersectionpoint Curve;
	Lint[4]:=stLine intersectionpoint xaxis;
	path cyclicPath;
	cyclicPath := buildcycle(Lint[1]--Lint[2],Curve,Lint[3]--Lint[4],reverse
xaxis,yaxis);
	draw cyclicPath withpen pencircle scaled 5pt withcolor red;
\stopuseMPgraphic
\useMPgraphic{buildS22}

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


             reply	other threads:[~2009-11-25  4:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25  4:45 Curiouslearn [this message]
2009-11-25  7:13 ` luigi scarso
2009-11-25  7:41   ` Taco Hoekwater
2009-11-25  7:47     ` Taco Hoekwater
2009-11-25 16:24       ` Curiouslearn
2009-11-25 16:58         ` Taco Hoekwater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3b4b12310911242045l29326562t10e13387ce56b2cb@mail.gmail.com \
    --to=curiouslearn@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).