围绕模基本域绘制轮廓

围绕模基本域绘制轮廓

我只是 TikZ 的初学者,我愿意在 Latex 中绘制 Serre 的书中找到的以下轮廓:

Contour of the modular fundamental domain

欢迎提供任何帮助或参考以有效地绘制这种轮廓(如果存在)!

答案1

更好的是,至少在手册中放一些包含一些基本内容的代码来帮助我摆脱这种情况,但因为它是一个你可以放在最后的简单代码,或者一个相当称职的代码,我的习惯是以我的方式重写它,因为这种情况允许它,这样使用、和的解决方案intersectionscalcdecorations.markings一些事情需要改进,但你有一个代码可以尝试理解如何......

结果:

enter image description here

梅威瑟:

\documentclass[border=20pt,tikz]{standalone}
\usetikzlibrary{intersections,calc,decorations.markings}

\begin{document}
    \begin{tikzpicture}[
        font=\scriptsize\bf\sffamily,
        scale=2,
        line width=0.75pt,
        MyArrow/.style={
            draw,
            postaction={
                decorate,
                decoration={
                    markings,
                    mark=at position #1 with {
                        \fill(0:3pt) -- (90+50:3pt) -- (180:1pt) -- (270-50:3pt) ;
                    }
                }
            }
        },
        Mydashed/.style={
            dash pattern =on 3pt off 2pt on 3pt off 2pt,
        }
    ]
    %Defining coodinates
    \coordinate(E) at (0.5,3); \node[anchor=south west] at (E) {E};
    \coordinate(A) at (-0.5,3); \node[anchor=south east] at (A) {A};
    \coordinate (O) at (0,0);
    \coordinate (O') at (90:1);

    %Draw the X axis
    \fill
        (O) circle (0.7pt) node[anchor=north]{0}
        (O') circle (0.7pt)
        (O)edge ++(1.2,0) edge++(-1.2,0);

    %Definig paths
    \path[name path=hemicircle]
        (0:1)node[anchor=north]{1}
            arc (0:180:1)node[anchor=north]{-1};
    \path[name path=CircleC]
        (O') circle (3pt);
    \path[name path=rectangleAE]
        (A) rectangle (E |- O);
    %Find firts intersections for centers of circles for B,B',D'D' points
    \path[name intersections={of=hemicircle and rectangleAE}]
        (intersection-1) coordinate (CenterCircleD) 
        (intersection-2) coordinate (CenterCircleB);
    %Defining paths for circles B and D
    \path[name path=CircleB] 
        (CenterCircleB) circle (5pt);
    \path[name path=CircleD] 
        (CenterCircleD) circle (5pt);

    %Find coordinates   
    \path[name intersections={of=hemicircle and CircleC}]
        (intersection-1) coordinate (C')
        (intersection-2) coordinate (C);
    \node[anchor=north] at (C') {C'};
    \node[anchor=north] at (C) {C};

    \path[name intersections={of=hemicircle and CircleB}]
        (intersection-1) coordinate (B')
        (intersection-2) coordinate (B'2);
        \node[anchor=north] at (B') {B'};
    \path[name intersections={of=rectangleAE and CircleB}]
        (intersection-1) coordinate (B)
        (intersection-2) coordinate (B2);
        \node[anchor=east] at (B) {B};

    \path[name intersections={of=hemicircle and CircleD}]
        (intersection-1) coordinate (D)
        (intersection-2) coordinate (D2);
        \node[anchor=north] at (D) {D};     
    \path[name intersections={of=rectangleAE and CircleD}]
        (intersection-1) coordinate (D')
        (intersection-2) coordinate (D'2);
        \node[anchor=west] at (D') {D'};

    \def\DrawArc[#1](#2)(#3)(#4)#5{%1:style 2: center 3: start 4: end 5: change direction if \n3>\n2 %Needs conditional improvement
        \draw[#1]
        let \p1 = ($(#3)-(#2)$), \p2 = ($(#4)-(#2)$),
            \n1 = {veclen(\x1,\y1)},
            \n2 = {atan2(\y1,\x1)},
            \n3 = {atan2(\y2,\x2)}
        in
            (#2)++(\n2:\n1) arc (\n2:\n3-#5:\n1);
    }

    %Drawing the contour
    \draw[MyArrow=0.5] (A) -- (B);
    \DrawArc[MyArrow=0.5](CenterCircleB)(B)(B'){0}
    \DrawArc[MyArrow=0.5](O)(B')(C){0}
    \DrawArc[MyArrow=0.5](O')(C)(C'){360}
    \DrawArc[MyArrow=0.5](O)(C')(D){0}
    \DrawArc[MyArrow=0.5](CenterCircleD)(D)(D'){0}  
    \draw[MyArrow=0.5] (D') -- (E);
    \draw[MyArrow=0.5] (E) -- (A);

    %Drawing other details

    \DrawArc[thick](O)(180:1)(CenterCircleB){0}
    \DrawArc[thick](O)(CenterCircleD)(0:1){0}
    \DrawArc[Mydashed](O)(CenterCircleB)(B'){0}
    \DrawArc[Mydashed](O)(D)(CenterCircleD){0}

    \draw[Mydashed] (B) -- (B |- O)node[anchor=north]{-1/2};
    \draw[Mydashed] (D') -- (D' |- O)node[anchor=north]{1/2};

    \end{tikzpicture} 
\end{document}

相关内容