使用自訂形狀標記交叉點 (TikZ)

使用自訂形狀標記交叉點 (TikZ)

我想標記之間的交集\pathcurve圓形和三角形之間的交點。我的圈子很好。但我的三角形有問題。三角形表示曲線的方向,它是一種箭頭。或許幫助你理解我在說什麼。

這是我的 MWE。為了方便,我把錯誤部分註解掉。

\documentclass[tikz, border=1mm]{standalone}
\usetikzlibrary{shapes, arrows.meta, intersections}
\def\trigl{iscoceles triangle[width=1.4mm, rotate=-3]}
\begin{document}
    \begin{tikzpicture}
        \draw[-stealth] (0,0) -- (6.7,0) 
            node[right]{$x$}; %x-axis
        \draw[-stealth] (0,0) -- (0,3) 
            node[above]{$y$}; %y-axis
        \draw [thick, name path=curve1,{Circle[length=1.4mm]}-{Circle[length=1.4mm]}]
            (0.2,1) .. controls (2,.6) and (2.7,.6) .. (2.9,1.5) 
                    .. controls (3.1,2.7) and (4,3) .. (6.5,1.8);
        \path [name path = line1] (1,0)--(1,3.5) (1.4,0)--(1.4,3.5) (2.3,0)--(2.3,3.5) (2.7,0)--(2.7,3.5) (2.93,0)--(2.93,3.5) (3.25,0)--(3.25,3.5) (3.6,0)--(3.6,3.5) (4.4,0)--(4.4,3.5) (5.3,0)--(5.3,3.5) (5.7,0)--(5.7,3.5);
        \fill [name intersections={of=curve1 and line1, name=i}]
        \foreach \s in {1,2,3,4,6,7,8,9,10}{(i-\s) circle (2pt)};
%       \fill [name intersections={of=curve1 and line1, name=i}] {(i-5) \trigl (2pt)};
    \end{tikzpicture}
\end{document}

答案1

node只需更改by的形狀regular polygon sides=3(如果是多邊形)或circle等等square,而不是定義新形狀。如果不希望其方向rotate=30或任何程度,您也可以旋轉它。

\documentclass[tikz, border=1mm]{standalone}
\usepackage{amsmath}
\usepackage{bm}
\usetikzlibrary{shapes, arrows.meta, intersections}
\begin{document}
    \begin{tikzpicture}
        \draw[-stealth] (0,0) -- (6.7,0) 
            node[right]{$x$}; %x-axis
        \draw[-stealth] (0,0) -- (0,3) 
            node[above]{$y$}; %y-axis
        \draw [thick, name path=curve1,{Circle[length=1.4mm]}-{Circle[length=1.4mm]}]
            (0.2,1) .. controls (2,.6) and (2.7,.6) .. (2.9,1.5) 
                    .. controls (3.1,2.7) and (4,3) .. (6.5,1.8);
        \path [name path = line1] (1,0)--(1,3.5) (1.4,0)--(1.4,3.5) (2.3,0)--(2.3,3.5) 
       (2.7,0)--(2.7,3.5) (2.93,0)--(2.93,3.5) (3.25,0)--(3.25,3.5) (3.6,0)--(3.6,3.5) 
       (4.4,0)--(4.4,3.5) (5.3,0)--(5.3,3.5) (5.7,0)--(5.7,3.5);
        \fill [name intersections={of=curve1 and line1, name=i}]
        \foreach \s in {1,2,3,4,6,7,8,9,10}{(i-\s) circle (2pt)};
       \path [name intersections={of=curve1 and line1, name=i}] (i-5) node[regular 
      polygon,regular polygon sides=3, fill,inner sep=1pt] {};
    \end{tikzpicture}
\end{document}

在此輸入影像描述

相關內容