使用 Geogebra 匯出幾何圖形

使用 Geogebra 匯出幾何圖形

我用Geogebra畫了一個圖,如下圖:

在此輸入影像描述

我從中匯出一個 TEX 檔:

\documentclass[0pt]{article}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
    \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]
    \draw (-6.398243018635849,29.30976776220647)-- (86.80087849068208,49.65488388110324);
    \draw (97.54228504819193,22.03412416179222)-- (15.084570096383837,-25.93175167641558);
    \draw [shift={(0,0)}] plot[domain=1.7857219540430334:5.239245930761878,variable=\t]({1*30*cos(\t r)+0*30*sin(\t r)},{0*30*cos(\t r)+1*30*sin(\t r)});
    \draw [shift={(90,35)}] plot[domain=-1.0439393764177076:1.785721954043033,variable=\t]({1*15*cos(\t r)+0*15*sin(\t r)},{0*15*cos(\t r)+1*15*sin(\t r)});
    \end{tikzpicture}
\end{document}

我認為我導出時使用了錯誤的單位,因此繪圖不適合圖紙:

我應該在匯出之前更正 Geogebra 中的某些內容,還是更正獲得的程式碼更有趣?

編輯

根據來自的評論馬蘇皮蘭。如何讓設計以板材為中心且寬度為70mm?

答案1

這不是你的問題,但在 tikz 中畫這個也很有趣...

輸出

在此輸入影像描述

程式碼

\documentclass[12pt,tikz]{standalone}
\begin{document}
\begin{tikzpicture}[rotate=39, scale=4]

  % parameters of the shape
  \def\thet{75}
  \def\r{.4}

  \coordinate (O) at (0,0) ;
  \coordinate (a1) at ({cos(\thet)},{sin(\thet)});
  \coordinate (a2) at ({cos(\thet)},{-sin(\thet)});
  \coordinate (vanish) at ({sec(\thet)},0);

  \path  (vanish) -- (a1) coordinate[pos=\r] (b1) 
         (vanish) -- (a2) coordinate[pos=\r] (b2) 
         (vanish) -- (O)  coordinate[pos=\r] (o) ;

 \pgfresetboundingbox

  \draw [blue, very thick, fill=red!20] (a1) 
    arc [start angle=\thet,end angle=360-\thet,radius=1] -- (b2) 
    arc [start angle=-\thet,end angle=\thet,radius=\r] -- cycle ; 

\end{tikzpicture}
\end{document}

答案2

您可以透過查看剪裁的矩形來計算 的值x,假設這是您通常想要查看的區域。

(在這種特殊情況下,剪裁是不必要的,因為沒有繪製的內容不在剪裁的矩形之外。因此您也可以查看繪製形狀的外部座標)。

x = 70mm / (175.88229072982594 - (-92.2298265729806)) = 0.26mm

為了保持軸比,您應該設定 y = x。然後你會得到這個結果(我添加了紅色矩形,以查看剪切區域):

\documentclass[0pt]{article}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
    \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=0.26mm,y=0.26mm]
    \clip(-92.2298265729806,-92.52338090781379) rectangle (175.88229072982594,94.97188107843031);
    \draw[red] (-92.2298265729806,-92.52338090781379) rectangle (175.88229072982594,94.97188107843031);
    \draw (-6.398243018635849,29.30976776220647)-- (86.80087849068208,49.65488388110324);
    \draw (97.54228504819193,22.03412416179222)-- (15.084570096383837,-25.93175167641558);
    \draw [shift={(0,0)}] plot[domain=1.7857219540430334:5.239245930761878,variable=\t]({1*30*cos(\t r)+0*30*sin(\t r)},{0*30*cos(\t r)+1*30*sin(\t r)});
    \draw [shift={(90,35)}] plot[domain=-1.0439393764177076:1.785721954043033,variable=\t]({1*15*cos(\t r)+0*15*sin(\t r)},{0*15*cos(\t r)+1*15*sin(\t r)});
    \end{tikzpicture}
\end{document}

在此輸入影像描述

相關內容