5

Problem Description

I am trying to draw a picture with some sort of Moon-Sickle in PSTricks, but I am not able to connect the circle segments together.

Sickle

MWE:

\documentclass[pstricks]{standalone}
\definecolor{ctcolorblack}{gray}{0}
\definecolor{ctcolorgray}{gray}{.5}
\definecolor{ctcolormain}{RGB}{0,150,255}

\begin{document}

\psset
{
    unit=0.001,
    linewidth=0.1pt,
}

\begin{pspicture}(18000,5000)

%% SICKLE
  \pscustom[
   linecolor=ctcolorgray,
   linewidth=1.0pt,
   fillstyle = solid,
   fillcolor = white
 ]{
    \psarc(2100,2100){1250}{22.03}{203.58}
    \psarc(2145,1600){1000}{75.39}{-203.56}
 }

\end{pspicture}

\end{document}
2
  • 2
    If you draw the outer arc counterclockwise (with \psarc), you need to switch to clockwise drawing (\psarcn) afterwards to keep the connection intact. Then you just have to figure out the right angles. Aug 14, 2022 at 11:14
  • Thanks, this is useful!
    – PaulJGD
    Aug 14, 2022 at 14:09

2 Answers 2

2

Purely for comparison, you can do that with the useful buildcycle macro in Metapost. Here is a version in MP, (without the engineering dimension annotation).

enter image description here

\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
path c[];
c1 = fullcircle scaled 2500 shifted (2100, 2100);
c2 = fullcircle scaled 2000 shifted (2145, 1600);
c3 = fullcircle scaled 1500 shifted (2615, 1850);
c4 = fullcircle scaled 1000 shifted (3085, 2100);
path sickle;
sickle = buildcycle(c1, c2, c3, c4);
fill sickle withcolor 15/16[blue, white];
draw sickle;
endfig;
\end{mplibcode}
\end{document}

This is wrapped up in luamplib, so you should compile this with lualatex or adapt it for plain Metapost.

The default unit of size in MP is the Postscript point, so with the dimensions given the figure is 3225 pt ≈ 113.7 cm on the diagonal, so you might want to scale it down a bit. One way to do that is to add the line:

sickle := sickle scaled 1/4;

after the buildcycle line. Then the figure would fit nicely on an A4 sheet.

1
  • Thanks for nice solution.
    – PaulJGD
    Aug 21, 2022 at 11:26
2

For PSTricks, there exists the package pst-intersect which I think is of use here, although this approach needs quite a lot of steps:

\documentclass[border=10pt]{standalone}
\usepackage{pst-intersect}

\definecolor{ctcolorgray}{gray}{.75}

\begin{document}

\psset{
    unit=0.001,
    linewidth=0.1pt,
}

\begin{pspicture}(5000,5000)

\pssavepath[linestyle=none]{c1}{\pscircle(2100,2100){1250}}
\pssavepath[linestyle=none]{c2}{\pscircle(2145,1600){1000}}
\pssavepath[linestyle=none]{c3}{\pscircle(2615,1850){750}}
\pssavepath[linestyle=none]{c4}{\pscircle(3085,2100){500}}

% reverse largest circle to clockwise
\pssavepath[linestyle=none]{s1}{
    \pstracecurve[tstart=4, tstop=0]{c1}
}

% get intersections of largest circle reversed and second largest circle
\psintersect[name=i1]{s1}{c2}

% save arc of largest circle segment plus arc of second largest segment
\pssavepath[linestyle=none]{s2}{
    \pstracecurve[istart=1, istop=2]{i1}{s1}
    \pstracecurve[istart=0, istop=1]{i1}{c2}
}

% get intersections of above path with third largest circle
\psintersect[name=i2]{s2}{c3}

% save path ... 
\pssavepath[linestyle=none]{s3}{
    \pstracecurve[istart=0, istop=1]{i2}{s2}
    \pstracecurve[istart=1, istop=2]{i2}{c3}
    \pstracecurve[istart=2, istop=3]{i2}{s2}
}

% and so on ...
\psintersect[name=i3]{s3}{c4}

% ... until we get the complete path which we can draw and fill
\pscustom[fillstyle=solid, fillcolor=ctcolorgray]{
    \pstracecurve[istart=0, istop=1]{i3}{s3}
    \pstracecurve[istart=1, istop=2]{i3}{c4}
    \pstracecurve[istart=2, istop=3]{i3}{s3}
}

\end{pspicture}

\end{document}

enter image description here


A similar solution using the fillbetween library provided by TikZ/PGF:

\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usetikzlibrary{fillbetween}

\begin{document}

\begin{tikzpicture}[x=0.01, y=0.01, line width=0.1pt, fill=gray!10]

    \path[name path=c1] (2100,2100) circle (1250);
    \path[name path=c2] (2145,1600) circle (1000);
    \path[name path=c3] (2615,1850) circle (750);
    \path[name path=c4] (3085,2100) circle (500);
    
    \path[name path=s12, intersection segments={of=c1 and c2, sequence={L1 -- R1[reverse]}}];
    \path[name path=s123, intersection segments={of=s12 and c3, sequence={L1 -- R1[reverse]}}];
    \filldraw[intersection segments={of=s123 and c4, sequence={L2 -- R2[reverse]}}];

\end{tikzpicture}

\end{document}

enter image description here

1
  • Educational, thanks!
    – PaulJGD
    Aug 21, 2022 at 11:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .