ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* About the macro path intersectionpoint path with Metapost
@ 2019-02-03 11:27 Fabrice Couvreur
  2019-02-04 14:16 ` Fabrice L
  0 siblings, 1 reply; 3+ messages in thread
From: Fabrice Couvreur @ 2019-02-03 11:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi,
I would like to reproduce the attached figure. My problem is to create the
points of intersection between the circles. It seems that my approach is
not the right one.
Thank you.
Fabrice

\starttext
\startMPcode
  path p, q, r, b ;
  p:= fullcircle scaled 6cm ;
  q:= fullcircle scaled 4cm shifted (2.5cm,2cm) ;
  r:= fullcircle scaled 4cm shifted (-2.5cm,2cm);
  b:= fullcircle scaled 2cm shifted (0,-3cm);
  pair A, B ;
  A:= p intersectionpoint r ;
  B:= p intersectionpoint r ;
  path u ;
  u:= A--B--cycle ;
  draw p ;
  draw q ;
  draw r ;
  draw b ;
  draw u numberstriped (.25,15,5) withcolor magenta ;
\stopMPcode
\stoptext

[-- Attachment #1.2: Type: text/html, Size: 1401 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
___________________________________________________________________________________

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

* Re: About the macro path intersectionpoint path with Metapost
  2019-02-03 11:27 About the macro path intersectionpoint path with Metapost Fabrice Couvreur
@ 2019-02-04 14:16 ` Fabrice L
  0 siblings, 0 replies; 3+ messages in thread
From: Fabrice L @ 2019-02-04 14:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Fabrice Couvreur


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

Hi,

I guess your problem is to find the two points of intersection between p
and r ? If so, the problem is that intersectionpoint does return the same
intersection when there is several, as it is the case here. So a quick
solution that you can do is to find intersections for the two part. A
drawing is simple than words ! here is the code to illustrate:

Happy drawing !
F.

\setupcolors[state=start]
\starttext
\startMPpage
  path p, q, r, b , u;
  p:= fullcircle scaled 6cm ;
  q:= fullcircle scaled 4cm shifted (2.5cm,2cm) ;
  r:= fullcircle scaled 4cm shifted (-2.5cm,2cm);
  b:= fullcircle scaled 2cm shifted (0,-3cm);
  pair A, B ;
  path rprime ;
  % Rprime is a a part of r (drawn in black to see it):
  rprime := r cutbefore point .5 along r;
  A:= p intersectionpoint r ;
  B:= p intersectionpoint rprime ;
  draw A withpen pencircle scaled .1in ;
  draw B withpen pencircle scaled .1in ;

  u:= A--B--cycle ;
  draw p withcolor green;
  draw q withcolor blue;
  draw rprime  withpen pencircle scaled .05in withcolor black;
  draw r withcolor red;
  draw b withcolor magenta;
  draw u numberstriped (.25,15,5) withcolor magenta ;
\stopMPpage
\stoptext


Le 3 février 2019 à 06:28:37, Fabrice Couvreur (fabrice1.couvreur@gmail.com)
a écrit:

Hi,
I would like to reproduce the attached figure. My problem is to create the
points of intersection between the circles. It seems that my approach is
not the right one.
Thank you.
Fabrice

\starttext
\startMPcode
  path p, q, r, b ;
  p:= fullcircle scaled 6cm ;
  q:= fullcircle scaled 4cm shifted (2.5cm,2cm) ;
  r:= fullcircle scaled 4cm shifted (-2.5cm,2cm);
  b:= fullcircle scaled 2cm shifted (0,-3cm);
  pair A, B ;
  A:= p intersectionpoint r ;
  B:= p intersectionpoint r ;
  path u ;
  u:= A--B--cycle ;
  draw p ;
  draw q ;
  draw r ;
  draw b ;
  draw u numberstriped (.25,15,5) withcolor magenta ;
\stopMPcode
\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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________

[-- Attachment #1.2: Type: text/html, Size: 5156 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
___________________________________________________________________________________

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

* Re: About the macro path intersectionpoint path with Metapost
       [not found] <mailman.54.1549201746.1205.ntg-context@ntg.nl>
@ 2019-02-03 23:26 ` Jeong Dal
  0 siblings, 0 replies; 3+ messages in thread
From: Jeong Dal @ 2019-02-03 23:26 UTC (permalink / raw)
  To: list ntg-context@ntg.nl ntg-context@ntg.nl ntg-context@ntg.nl
	ntg-context@ntg.nl

Dear Fabrice,

Metapost is great for drawiang figures  but it is not easy for me  to use it.

>  b:= fullcircle scaled 2cm shifted (0,-3cm);
>  pair A, B ;
>  A:= p intersectionpoint r ;
>  B:= p intersectionpoint r ;
>  path u ;
>  u:= A--B--cycle ;

 A and B are the same point. One of “r” should be changed to “q” or “b”.
Then you can have a line.
I also made similar errors many times too.

Btw, is there any reason to add “—cycle”?

Enjoy the drawing.

Best regards,

Dalyoung
___________________________________________________________________________________
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
___________________________________________________________________________________

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

end of thread, other threads:[~2019-02-04 14:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-03 11:27 About the macro path intersectionpoint path with Metapost Fabrice Couvreur
2019-02-04 14:16 ` Fabrice L
     [not found] <mailman.54.1549201746.1205.ntg-context@ntg.nl>
2019-02-03 23:26 ` Jeong Dal

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