如何在 METAPOST 中绘制圆与路径的交点

如何在 METAPOST 中绘制圆与路径的交点

如何仅绘制减去粗红线后剩下的圆的两条边?

\documentclass{article}

\usepackage{luacode}
\usepackage{luamplib}
\usepackage{calc}
\usepackage{xcolor}
\usepackage{forloop}

\setlength{\unitlength}{1bp}
\setlength{\parindent}{0sp}

\begin{document}
\pagestyle{empty}

\begin{picture}(0,0)
\put(0,-72){
\begin{mplibcode}
beginfig(1);

pair A, B, C, D, E, F, G, H, I, J;

A:=(72 bp,18 bp); B:=(135 bp,72 bp);
C:=(72 bp,135 bp); D:=(9 bp,72 bp);

draw A..B..C..D..cycle;

E :=(72 bp,144 bp);
F := (36 bp,108 bp);
G := (72 bp,72 bp);
H := (108 bp,36 bp);
I := (72 bp,0);

draw E..F..G..H..I withcolor red withpen pencircle scaled 9 bp;

endfig;
\end{mplibcode}}
\end{picture}
\end{document}

黑色圆圈和红色路径

答案1

我不知道这是否是最好的解决方案,但至少它得到了交集。(我很久没有使用 metafont 了。)

\documentclass{article}

\usepackage{luacode}
\usepackage{luamplib}
\usepackage{calc}
\usepackage{xcolor}
\usepackage{forloop}

\setlength{\unitlength}{1bp}
\setlength{\parindent}{0sp}

\begin{document}
\pagestyle{empty}

\begin{picture}(0,0)
\put(0,-72){
\begin{mplibcode}
beginfig(1);

pair A, B, C, D, E, F, G, H, I, J;
path curve, circle;

A:=(72 bp,18 bp); B:=(135 bp,72 bp);
C:=(72 bp,135 bp); D:=(9 bp,72 bp);

circle = A..B..C..D..cycle;
draw circle;

E :=(72 bp,144 bp);
F := (36 bp,108 bp);
G := (72 bp,72 bp);
H := (108 bp,36 bp);
I := (72 bp,0);

curve=E..F..G..H..I;
draw curve withcolor red withpen pencircle scaled 9 bp;

dotlabel.ulft("1", curve intersectionpoint circle);

dotlabel.ulft("2", curve intersectionpoint subpath (4,6) of circle);

endfig;
\end{mplibcode}}
\end{picture}
\end{document}

在此处输入图片描述

相关内容