在此感谢原作者!
效果图如下:
代码如下:
\documentclass[margin=12pt,pstricks]{standalone}
\usepackage{pst-intersect}
\makeatletter
\def\convexhull{\pst@object{convexhull}}
\def\convexhull@i{%
\begin@ClosedObj
\pst@getcoors[\convexhull@ii%
}
\def\convexhull@ii{%
\addto@pscode{%
\pst@intersectdict
] ArrayToPointArray
ConvexHull PointArrayToArray
mark exch aload pop
end
}%
\pspolygon@ii
}%
\makeatother
\begin{document}
\begin{pspicture}[showgrid](5,4)
\convexhull[fillcolor=red!20, fillstyle=solid](1,1)(2,2)(1,2)(3,3)(4,2)(2,3)(3,2)
\psdots(1,1)(2,2)(1,2)(3,3)(4,2)(2,3)(3,2)
\end{pspicture}
\end{document}
- 如想修改fillstyle,可参考:https://tug.org/PSTricks/doc/sarovar/chap2.pdf
- 如想在图上插入文字,可使用:
\rput[tl](3.5,3){\fontsize{30pt}{30pt}\selectfont$A$}
其中,(3.5,3)表示插入位置,30pt表示文字大小,A是文字内容