多边形彼此相邻

多边形彼此相邻

我正在尝试并排绘制两个正多边形,但第二个多边形总是比我想要的要大。有人能帮我吗?

这需要tkz-obj-polygons.tex,这是用于制作正多面体的测试版代码(参见https://tex.stackexchange.com/a/35291/),可从http://altermundus.com/pages/downloads/packages/euclide/tkz-obj-polygons.tex

\documentclass{standalone}
\usepackage{tkz-euclide}
\usetikzlibrary{hobby}
\usetkzobj{all}

\begin{document}
\begin{tikzpicture}[scale=1]
    \tkzDefPoints{-4/0/A, -1/0/B, 5/0/C, 7.5/0/D}

    \draw[help lines, color=gray!30, dashed] (-5,-1.5) grid (10,5.5);
    \draw [->, >=stealth] (-5,0) -- (10,0) node [right] {$x$};
    \draw [->, >=stealth] (0,-1.5) -- (0,5) node [above] {$y$};

    \tkzDefRegPolygon[side,sides=5](A,B)\tkzGetPoint{O}
    \tkzDrawPolygon[thick](P1,P2,P3,P4,P5)

    \tkzDefRegPolygon[side,sides=6](C,D)\tkzGetPoint{P}
    \tkzDrawPolygon[thick](P1,P2,P3,P4,P5,P6)

    \tkzLabelPoints[below](A,B,C,D)


\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

等待下一个版本这里是一个修正

\documentclass{standalone}
\usepackage{tkz-euclide}
\usetikzlibrary{hobby}
\usetkzobj{all}
\makeatletter
\def\tkzRegPolygonSide(#1,#2){
\begingroup  
% get the center 
\pgfmathsetmacro{\tkz@regangle}{360/\tkz@regpolsides*(\tkz@regpolsides-1)} 
\pgfmathsetmacro{\tkz@regangleside}{(180-\tkz@regangle)/2} 
\tkzDefMidPoint(#1,#2)\tkzGetPoint{tkz@tempPt} 
\tkzCalcLength\[cm\](tkz@tempPt,#1) \tkzGetLength{tkz@len} 
\pgfmathsetmacro{\tkz@inscriberadius}{%
     \tkz@len*tan(90*(\tkz@regpolsides-2)/\tkz@regpolsides)} 
\tkzDefPointWith\[orthogonal normed,K=\tkz@inscriberadius\](tkz@tempPt,#2)   
\tkzGetPoint{tkz@RegPolCenter} 
\tkzRegPolygonCenter(tkz@RegPolCenter,#1)       
\tkzRenamePoint(tkz@RegPolCenter){tkzPointResult}  
\endgroup
}
\makeatother 

\begin{document}
\begin{tikzpicture}\[scale=1\]
    \tkzDefPoints{-4/0/A, -1/0/B, 5/0/C, 7/0/D}

    \draw\[help lines, color=gray!30, dashed\] (-5,-1.5) grid (10,5.5);
    \draw \[->, >=stealth\] (-5,0) -- (10,0) node \[right\] {$x$};
    \draw \[->, >=stealth\] (0,-1.5) -- (0,5) node \[above\] {$y$};


    \tkzDefRegPolygon\[side,sides=5,name=P\](A,B)
    \tkzDrawPolygon\[thick\](P1,P2,P3,P4,P5)

    \tkzDefRegPolygon\[side,sides=6,name=R\](C,D)
    \tkzDrawPolygon\[thick\](R1,R2,R3,R4,R5,R6)

    \tkzLabelPoints\[below\](A,B,C,D)

\end{tikzpicture}
\end{document}

相关内容