힘의 순간

힘의 순간

나는 많이 봤지만 관련된 것을 찾지 못했습니다. Tikz에서 다음 그림을 만드는 방법은 무엇입니까?

https://fr.wikipedia.org/wiki/Moment_d%27une_force#/media/Fichier:Momento_de_uma_for%C3%A7a..png

지금까지 내가 한 일은 다음과 같습니다.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}

    % Define angle and force magnitude
    \def\angle{70} % Angle in degrees
    \def\Fnorm{3} % Magnitude of the force vector

    % Define coordinates
    \coordinate (O) at (0,0); % Origin
    \coordinate (P) at (1,1); % tail of force 
    \coordinate (F) at ({1 + \Fnorm * cos(\angle)}, {1 + \Fnorm * sin(\angle)}); % Force head
% Calculate coordinates for point Q
\coordinate (Q) at ({1 + 1.2*cos(\angle)}, {1 + 1.2*sin(\angle)});

    % Draw the force vector
    \draw[-latex, thick, blue] (P) -- (F) node[midway, right] {$\vec{F}$};
            
%      Draw position vectors
    \draw[-latex, thick, red] (O) -- (P) node[midway, right] {$\vec{r}$};
        \draw[-latex, thick, orange] (O) -- (Q) node[midway, left] {$\vec{r'}$};
    
        \fill (Q) circle[radius=1pt] node[  left] {$Q$};
        
                \fill (P) circle[radius=1pt] node[below right] {$P$};

        \fill (O) circle[radius=1pt] node[ below] {$O$}; % origin

\end{tikzpicture}

\end{document}

여기에 이미지 설명을 입력하세요

벡터 OP의 방향과 이에 수직인 투영, 모멘트 암 및 모멘트 벡터를 나타내는 곱슬 벡터를 어떻게 쉽게 얻을 수 있습니까?

도움을 주셔서 대단히 감사합니다.

답변1

업데이트

PF보다 3배 더 긴 길이를 얻으려면 연산 OP을 사용합니다 let.

\path let  \p1=($(P)-(O)$),
            \n1 = {veclen(\x1,\y1)},
            in 
(O)--(P)--([turn]\angle:\n1*\Fnorm])coordinate (F);

계산을 단순화하기 위해 좌표를 정의하는 방식을 변경했습니다. 그리고 많은 변경 사항을 적용했기 때문에 이를 모두 설명할 시간이 없습니다. 코드를 보도록 할게요. 이해가 안 되는 부분이 있으면 말씀해 주시면 설명해 드리겠습니다.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,angles}

\begin{document}

\begin{tikzpicture}[every node/.style={font=\footnotesize}]

    % Define angle and force magnitude
    \def\angle{60} % Angle in degrees
    \def\Fnorm{3} % Magnitude of the force vector

    % Define coordinates
    \coordinate[label=left:O] (O) at (0,0); % Origin
    \coordinate (P) at (2,1); % tail of force 

    \path let  \p1=($(P)-(O)$),
                \n1 = {veclen(\x1,\y1)},
                in 
    (O)--(P)--([turn]\angle:\n1*\Fnorm])coordinate (F);
    \coordinate[label=left:Q] (Q) at ($(P)!.4!(F)$);
    \fill (Q) circle[radius=1pt];

    % Draw the force vector
    \draw[-latex, thick, blue] (P) -- (F) node[midway, right] {$\vec{F}$};
            
%      Draw position vectors
    \draw[-latex, thick, red] (O) -- (P) node[midway, above,yshift=-3pt] {$\vec{r}$};
        \draw[-latex, thick, orange] (O) -- (Q) node[midway, left] {$\vec{r'}$};
           
        \fill (P) circle[radius=1pt] node[below right] {$P$};

        \fill (O) circle[radius=1pt];% node[ below] {$O$}; % origin
        
        \coordinate (H) at ($(O)!(F)!(P)$);
        \draw(F)--(H)node[midway,right]{$F\sin\theta$};
        \draw[dashed] (P)--($(P)!1.2!(H)$);
        \coordinate(H') at ($(F)!(O)!(P)$);
        \draw(O)--(H')node[midway,sloped,below]{$r\sin\theta$};
        \draw[dashed] (P)--($(P)!1.5!(H')$);
        \pic[draw,pic text=$\theta$,angle radius=4mm,angle eccentricity=1.35]{angle=O--P--H'};
        \pic[draw,pic text=$\theta$,angle radius=4mm,angle eccentricity=1.35]{angle=H--P--F};
        
        \node[inner sep=0pt] (Mo) at (barycentric cs:O=1,P=-.5 ,F=1){$M_o$};
        \draw[->,very thick, blue] (Mo.south west)to[out=-90,in=-90,looseness=2](Mo.south east);
\end{tikzpicture}

\end{document}

여기에 이미지 설명을 입력하세요

답변2

업데이트된 코드를 답변으로 게시합니다. 위키 이미지와는 거리가 멀지만 여전히 다른 사람들에게는 유용할 수 있습니다.

\documentclass{standalone}
\usepackage{tikz}
\usepackage{amsmath} % for trigonometric functions

\begin{document}

\begin{tikzpicture}
    % Draw axes
    \draw[->] (-0.5,0) -- (3,0) node[right] {$x$};
    \draw[->] (0,-0.5) -- (0,3) node[above] {$y$};

    % Define point P
    \coordinate (P) at (1,1);
    
    % Define point O
    \coordinate (O) at (0,0);

    % Calculate coordinates of point Q
    \pgfmathsetmacro{\phhi}{60} % angle in degrees
    \pgfmathsetmacro{\magnitude}{3} % magnitude of vector PQ
    \pgfmathsetmacro{\qx}{\magnitude * cos(\phhi)} % x-coordinate of Q
    \pgfmathsetmacro{\qy}{\magnitude * sin(\phhi)} % y-coordinate of Q

    % Define point Q
    \coordinate (Q) at ({1 + \qx}, {1 + \qy});
    
    % Calculate coordinates for parallel and perpendicular components of F
    \pgfmathsetmacro{\thheta}{45} % angle in degrees
    \pgfmathsetmacro{\parallelX}{\magnitude * cos(\phhi-\thheta)*cos(\thheta)} % x-coordinate of F_parallel
    \pgfmathsetmacro{\parallelY}{\magnitude * cos(\phhi-\thheta)*sin(\thheta)} % y-coordinate of F_parallel
    \coordinate (R) at ({1 + \parallelX}, {1 + \parallelY}); % Endpoint of F_parallel
    
    \pgfmathsetmacro{\perpendicularX}{\magnitude * sin(\phhi-\thheta)*sin(\thheta)} % x-coordinate of F_perpendicular
    \pgfmathsetmacro{\perpendicularY}{\magnitude * sin(\phhi-\thheta)*cos(\thheta)} % y-coordinate of F_perpendicular
    \coordinate (S) at ({1 - \perpendicularX}, {1 + \perpendicularY}); % Endpoint of F_perpendicular
    
    % Calculate coordinates of point T
    \pgfmathsetmacro{\Tx}{sqrt(2) * cos(90-\phhi) * sin(\phhi-\thheta)} % x-coordinate of T
    \pgfmathsetmacro{\Ty}{-sqrt(2) * sin(90-\phhi) * sin(\phhi-\thheta)} % y-coordinate of T
    % Define point T
    \coordinate (T) at (\Tx, \Ty);

    % Draw vector PQ
    \draw[-latex, thick] (P) -- (Q) node[midway, above] {$\vec{F}$};
    
    % Draw vector OP
    \draw[-latex, thick] (O) -- (P) node[midway, above] {$\vec{r}$};
    
    % Draw vector F_parallel
    \draw[-latex, thick] (P) -- (R) node[midway, below right] {$\vec{F_{\parallel}}$};
    
    % Draw vector F_perpendicular
    \draw[-latex, thick] (P) -- (S) node[midway, left] {$\vec{F_{\perp}}$};

    % Draw point P
    \fill (P) circle[radius=2pt] node[below right] {$P$};
    
    % Draw point O
    \fill (O) circle[radius=2pt] node[below left] {$O$};
    
    % Draw dashed lines for projections
    \draw[dashed] (S) -- (Q) -- (R);
    
    % Draw arc for angle theta
    \draw (0.5,0) arc[start angle=0,end angle=45,radius=0.5cm];
    \node at (0.7,0.3) {$\theta$}; % Label for angle theta
    
    % Draw the arc for angle phi
    \draw (1,1) +(0:0.5cm) arc[start angle=0, end angle=\phhi, radius=0.5cm];
    \node at (1.6,1.3) {$\phi$}; % Label for angle phi
    
    % Draw arc for angle phi - theta
    \draw (1,1) +(\thheta:1cm) arc[start angle=\thheta, end angle=\phhi, radius=1cm];
    \node at (1.65,1.9) {$\alpha$}; % Label for angle phi - theta
   
    % Draw dotted line from P to (2,1)
    \draw[dotted] (P) -- (2,1);
   
    % Draw dashed line from O to T
    \draw[dashed] (O) -- (T);
   
    % Draw dashed line from P to T
    \draw[dashed] (P) -- (T);

\end{tikzpicture}

\end{document}

힘의 순간

답변3

AndréC의 코드에서 를 사용하여 tkz-elements점을 정의하고 tkz-euclide플롯 tikz을 수행합니다.

코드

% !TeX program = lualatex
\documentclass{standalone}
\usepackage{tkz-elements}
\usepackage{tkz-euclide}
\begin{document}
\begin{tkzelements}
    angle = math.pi/3
    Fnorm = 3
    --
    z.O  = point: new (0,0)
    z.P  = point: new (2,1)
    --
    -----------------------------
    -- translation and rotation
    V.v = vector: new (z.O,z.P)
    V.w = Fnorm*V.v
    -- in one step
    z.F  = z.P : rotation (angle,V.w.head : at (z.P))
    --
    --   or in two steps
    --z.Pp = V.w.head : at (z.P)
    -- rotation
    --z.F  = z.P : rotation (angle,z.Pp)
--------------------------------------
L.PF  = line : new (z.P,z.F)
z.Q   = L.PF : barycenter (6,4)
-- projection
z.Op  = L.PF: projection(z.O)
L.OP  = line : new (z.O,z.P)
z.Fp  = L.OP: projection(z.F)
\end{tkzelements}

\tkzSetUpLabel[font=\footnotesize]
\begin{tikzpicture}
    %\draw[help lines] (0,0)grid(8,8);
\tkzGetNodes
% points
\tkzDrawPoints(O,P,F,Q,O',F')
\tkzLabelPoints[below right](P)
\tkzLabelPoints[left](O,F,Q)
% line
\tkzDrawLine[dashed,add = 0 and 0.25](P,O')
\tkzDrawLine[dashed,add = 0 and 0.25](P,F')
% vecteurs
\tkzDrawSegments[-latex, thick, blue](P,F)
\tkzDrawSegments[-latex, thick, red](O,P)
\tkzDrawSegments[-latex, thick, orange](O,Q)
\tkzDrawSegments(O,O' F,F')
%
\tkzLabelSegment[blue,right](P,F){$\vec{F}$}
\tkzLabelSegment[red,above](O,P){$\vec{v}$}
\tkzLabelSegment[orange,above](O,Q){$\vec{r'}$}
\tkzLabelSegment[sloped,below](O,O'){$r\sin\theta$}
\tkzLabelSegment[right](F,F'){$F\sin\theta$}
% angle
\tkzMarkAngles[size = 0.4](O,P,O' F',P,F)
\tkzLabelAngle[pos=0.6](O,P,O'){$\theta$}
\tkzLabelAngle[pos=0.6](F',P,F){$\theta$}
% code AndréC
\node[inner sep=0pt] (Mo) at (barycentric cs:O=1,P=-.5 ,F=1){$M_o$};
\draw[->,very thick, blue] (Mo.south west)to[out=-90,in=-90,looseness=2](Mo.south east);
\end{tikzpicture}

\end{document}

편집하다: 나는 tkz-elementsMatrix 클래스를 사용해 보았습니다.

    % !TeX program = lualatex
    \documentclass{article}
    \usepackage{amsmath}
    \usepackage{tkz-elements}
    \usepackage{tkz-euclide}
    \begin{document}
    \begin{tkzelements}
        z.P     = point : new (2,1)
        angle   = math.pi/3
        Fnorm   = 3
        -----------------------------
        z.O     = point : new (0,0)
        V.OP     = z.P.mtx : homogenization ()
        --V.OP : print () tex.print('\\\\')
        --
        M       = matrix : htm (angle , z.P.re , z.P.im)
        --M : print () tex.print('\\\\')
        S       = matrix : square (3,Fnorm,0,0,0,Fnorm,0,0,0,1)
        --S : print () tex.print('\\\\')
        V.F      = M * S * V.OP
        --V.F : print () tex.print('\\\\')
        z.F = get_htm_point(V.F)
        --tex.print(display(z.F))
        --------------------------------------
        L.PF  = line : new (z.P,z.F)
        z.Q   = L.PF : barycenter (6,4)
        -- projection
        z.Op  = L.PF: projection(z.O)
        L.OP  = line : new (z.O,z.P)
        z.Fp  = L.OP: projection(z.F)
    \end{tkzelements}


    \tkzSetUpLabel[font=\footnotesize]
    \begin{tikzpicture}[gridded]
        \tkzGetNodes
        % points
        \tkzDrawPoints(O,P,F,Q,O',F')
        \tkzLabelPoints[below right](P)
        \tkzLabelPoints[left](O,F,Q)
        % line
        \tkzDrawLine[dashed,add = 0 and 0.25](P,O')
        \tkzDrawLine[dashed,add = 0 and 0.25](P,F')
        % vecteurs
        \tkzDrawSegments[-latex, thick, blue](P,F)
        \tkzDrawSegments[-latex, thick, red](O,P)
        \tkzDrawSegments[-latex, thick, orange](O,Q)
        \tkzDrawSegments(O,O' F,F')
        %
        \tkzLabelSegment[blue,right](P,F){$\vec{F}$}
        \tkzLabelSegment[red,above](O,P){$\vec{v}$}
        \tkzLabelSegment[orange,above](O,Q){$\vec{r'}$}
        \tkzLabelSegment[sloped,below](O,O'){$r\sin\theta$}
        \tkzLabelSegment[right](F,F'){$F\sin\theta$}
        % angle
        \tkzMarkAngles[size = 0.4](O,P,O' F',P,F)
        \tkzLabelAngle[pos=0.6](O,P,O'){$\theta$}
        \tkzLabelAngle[pos=0.6](F',P,F){$\theta$}
        % code AndréC
        \node[inner sep=0pt] (Mo) at (barycentric cs:O=1,P=-.5 ,F=1){$M_o$};
        \draw[->,very thick, blue] (Mo.south west)to[out=-90,in=-90,looseness=2](Mo.south east);
    \end{tikzpicture}
    \end{document}

여기에 이미지 설명을 입력하세요

관련 정보