ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Willi Egger <context@boede.nl>
To: NTG-Context ConTeXt users <ntg-context@ntg.nl>
Subject: Trouble constructing a drawer rail with MP
Date: Fri, 21 May 2021 12:56:56 +0200	[thread overview]
Message-ID: <8B7AC91D-3279-4F0B-A792-5667A7D35BCD@boede.nl> (raw)


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

Hello MP Gurus!

I wanted to make a technical drawing. However the enclosed mwe does not give me the required results.

While the vector from point 1 is directing in the desired direction of 194 degrees, the second vector from point 2 does not as defined point in the direction of 166 degrees.

What am I doing wrong here?


Thanks for pointing me into the right direction :-)

Willi


[-- Attachment #1.2.1: Type: text/html, Size: 732 bytes --]

[-- Attachment #1.2.2: test-rail.pdf --]
[-- Type: application/pdf, Size: 5237 bytes --]

[-- Attachment #1.2.3: Type: text/html, Size: 235 bytes --]

[-- Attachment #1.2.4: test-rail.tex --]
[-- Type: application/octet-stream, Size: 850 bytes --]


\startuniqueMPgraphic{Rail}
	path p[];
	pair Pkt[];
	
	p[100] := unitsquare xscaled 15mm yscaled 50mm;
	p[101] := (lrcorner p[100]--urcorner p[100]) shifted (-5mm,0) ;
	
	Pkt[1] := point 1.2 of p[100];
	Pkt[2] := point 1.8 of p[100];
	
	p[102] := Pkt[1]--dir(194)*10mm;
	
	Pkt[3] := p[102] intersectionpoint p[101];
	
	p[103] := Pkt[2]--dir(166)*10mm;
	
	Pkt[4] := p[103] intersectionpoint p[101];
	
	p[104] := lrcorner p[100]--Pkt[1]--Pkt[3]--Pkt[4]--Pkt[2]--urcorner p[100];
	
	draw p[104];
	
	draw p[100];
	draw p[101] dashed withdots;

	for i = 1 upto 4 :
	 draw Pkt[i] withpen pencircle scaled 3pt withcolor red;
  endfor;
	
	label.lft(textext("Pkt 2"),Pkt[3]);
	label.lft(textext("Pkt 4"),Pkt[4]);
	label.rt(textext("Pkt 1"), Pkt[1]);
	label.rt(textext("Pkt 2"), Pkt[2]);
\stopuniqueMPgraphic

\startTEXpage

	\useMPgraphic{Rail}

\stopTEXpage

[-- Attachment #1.2.5: Type: text/html, Size: 243 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2021-05-21 10:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 10:56 Willi Egger [this message]
2021-05-21 11:15 ` Jairo A. del Rio
2021-05-21 19:26   ` Willi Egger
2021-05-21 19:58     ` Mikael Sundqvist
2021-05-22 20:49       ` Willi Egger

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=8B7AC91D-3279-4F0B-A792-5667A7D35BCD@boede.nl \
    --to=context@boede.nl \
    --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).