答案1
一个残酷的想法:下面的装饰将标记给定路径上的九十个里程碑。
\documentclass[border=9,tikz]{standalone}
\usetikzlibrary{calc,decorations}
\pgfdeclaredecoration{mark milestone}{initial}{
\state{initial}[width=0pt,next state=mark]{
\xdef\markmilestoneindex{0}
\xdef\markmilestonename{\csname tikz@fig@name\endcsname}
\pgfmathsetmacro\markmilestonesep{\pgfdecoratedpathlength/90}
\xdef\markmilestonesep{\markmilestonesep}
}
\state{mark}[width=\markmilestonesep pt]{
\coordinate(\markmilestonename-\markmilestoneindex);
\pgfmathtruncatemacro\markmilestoneindex{\markmilestoneindex+1}
\xdef\markmilestoneindex{\markmilestoneindex}
}
\state{final}{
\pgftransformshift{\pgfpointdecoratedpathlast}
\coordinate(\markmilestonename-\markmilestoneindex);
}
}
\begin{document}
\begin{tikzpicture}
\draw[rounded corners,
postaction={name=irreshape,decorate,decoration=mark milestone}]
(0:2)foreach\i in{1,...,11}{--(\i*30:3+rnd)}--cycle
[sharp corners]; %https://tex.stackexchange.com/questions/38989/
\draw foreach\i[evaluate={\a=\i*4-180};]in{0,...,90}{
(irreshape-\i)circle(.4pt)node[anchor=\a]{\tiny\i}
};
\end{tikzpicture}
\end{document}
现在你可以算出这些点所组成的四千零五条线段的长度,看看谁最长。