如何从梯形的中心到顶部和底部表面画一条线?在这种情况下,使用 M.north 或 M.south 无效

如何从梯形的中心到顶部和底部表面画一条线?在这种情况下,使用 M.north 或 M.south 无效

我现在看到的图像

\documentclass[letterpaper,10pt]{article}
\usepackage{tikz,pgfplotstable}
\usepackage{tkz-euclide}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usetikzlibrary{scopes}
\usetkzobj{all}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
\usepackage{esvect}
\usepackage{mathtools}
\usepackage{bm}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{decorations.pathmorphing,patterns}
\usetikzlibrary{shapes,backgrounds}
\usepackage{amsmath}  % improve math presentation
\usepackage{graphicx}

\begin{document}


\def\TrLeangle{60}
\def\TrRiangle{120}

\begin{tikzpicture}[W/.style={trapezium,draw,fill=gray,fill opacity=0.3,minimum width=5cm, minimum height=1cm,trapezium left angle=\TrLeangle, trapezium right angle=\TrRiangle,thin,trapezium stretches=false},
axis/.style={densely dashed,gray,font=\small},
force/.style={>=latex,draw=blue,fill=blue},>=Triangle]

            \node[W] (W) {};
            \draw [->,dashed,thick](W.center) -- (1.0,2) node[right] {$\boldsymbol{y}$};%make do solution to get the desired result
            \draw [->,ultra thick,red](W.center) -- (W.north) node[above {$+y$};%problem line
            \draw [->,dashed,thick](W.center) -- ++(0,2) node[above right,rotate=0] {$\boldsymbol{z}$};
            \draw [->,dashed,thick](W.center) -- ++(3,0) node[right,rotate=0] {$\boldsymbol{x}$};
      
\end{tikzpicture}

\end{document}

以上是我想制作的 tikz 图的代码片段。基本上,我想要一条沿 y 轴(而不是 +y 轴)延伸并终止于平行四边形“顶部”的线。通常对于矩形,使用 M.north 的效果与使用 M.east 和 M.west 一样好。但在这里对于平行四边形,相同的命令失败了。任何解决方案都将不胜感激。

答案1

像这样?

在此处输入图片描述

\documentclass[letterpaper,10pt]{article}
\usepackage{tikz}
\usepackage{mathtools}
\usepackage{bm}
\usetikzlibrary{shapes.geometric, arrows.meta}
\usepackage{amsmath}  % improve math presentation

\begin{document}


\def\TrLeangle{60}
\def\TrRiangle{120}

\begin{tikzpicture}[%
    W/.style={trapezium, draw, fill=gray, fill opacity=0.3,
        minimum width=5cm, minimum height=1cm, 
        trapezium left angle=\TrLeangle, trapezium right angle=\TrRiangle,
        thin, trapezium stretches=false},
    axis/.style={densely dashed,gray,font=\small},
    force/.style={>=latex,draw=blue,fill=blue},>=Triangle]

            \node[W] (W) {};
            \draw[->,red] (W.center)--(W.top side);
            \draw[->,red] (W.center)--(W.right side);
            
%            \draw [->,dashed,thick](W.center) -- (1.0,2) node[right] {$\boldsymbol{y}$};%make do solution to get the desired result
%            \draw [->,ultra thick,red](W.center) -- (W.north) node[above] {$+y$};%problem line
%            \draw [->,dashed,thick](W.center) -- ++(0,2) node[above right,rotate=0] {$\boldsymbol{z}$};
%            \draw [->,dashed,thick](W.center) -- ++(3,0) node[right,rotate=0] {$\boldsymbol{x}$};
      
\end{tikzpicture}

\end{document}

相关内容