有没有一种简单的方法可以用 PSTricks 绘制如图所示的三角形?也许有一种计算特定高度外线位置的方法?
我正在使用此虚拟示例中的环境:
\documentclass[letterpaper,dvips]{article}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pst-all}
\usepackage{pst-eps}
\usepackage{color}
\begin{document}
\pagestyle{empty}
\begin{TeXtoEPS}
\fontfamily{phv}\selectfont
\psset{xunit=1cm,yunit=1cm,runit=1cm}
\begin{pspicture}(10,10)
\end{pspicture}
\end{TeXtoEPS}
\end{document}
答案1
\documentclass[border=12pt,pstricks]{standalone}
\usepackage{multido}
\begin{document}
\begin{pspicture}[showgrid=false](6,-6)
\multido{\iy=-1+-1,\nw=1+1,\nh=1+1}{6}{\pstriangle(3,\iy)(\nw,\nh)}
\end{pspicture}
\end{document}
动画版:
\documentclass[border=12pt,pstricks]{standalone}
\usepackage{multido}
\begin{document}
\multido{\iy=-1+-1,\nw=1+1,\nh=1+1}{6}{%
\begin{pspicture}[showgrid=false](6,-6)
\pstriangle(3,\iy)(\nw,\nh)
\end{pspicture}}
\end{document}
答案2
\documentclass[border=12pt,pstricks]{standalone}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}(12,6)
\pspolygon[fillstyle=hlines,hatchangle=0,hatchsep=1cm](0,0)(6,0)(3,6)
\pstriangle[fillstyle=hlines,hatchangle=0,hatchsep=1cm,hatchcolor=red](9,0)(6,6)
\end{pspicture}
\end{document}
答案3
裁剪方法:
\documentclass[border=12pt,pstricks]{standalone}
\begin{document}
\pspicture(6,-6)
\psclip{\pstriangle(3,-6)(6,6)}
\multips(0,-1)(0,-1){5}{\psline(6,0)}
\endpsclip
\endpspicture
\end{document}
答案4
使用包中提供的 Homothetie 宏的过度解决方案pst-eucl
。
\documentclass[border=12pt,pstricks]{standalone}
\usepackage{multido}
\usepackage{pst-eucl}
\begin{document}
\begin{pspicture}[showgrid=false](6,-6)
\psset{PointName=none,PointSymbol=none}
\pstGeonode[CurveType=polygon](3,0){A}(0,-6){B}(6,-6){C}
\multido{\n=0.166+0.166}{5}
{
\pstHomO[HomCoef=\n]{A}{B,C}
\pstLineAB{B'}{C'}
}
\end{pspicture}
\end{document}
忘记附上动画了:
\documentclass[border=12pt,pstricks]{standalone}
\usepackage{multido}
\usepackage{pst-eucl}
\begin{document}
\multido{\n=0.166+0.166}{5}{%
\begin{pspicture}[showgrid=false](6,-6)
\psset{PointName=none,PointSymbol=none}
\pstGeonode[CurveType=polygon](3,0){A}(0,-6){B}(6,-6){C}
\pstHomO[HomCoef=\n]{A}{B,C}
\pstLineAB{B'}{C'}
\end{pspicture}}
\end{document}