%% $Id: pst-hyperboloid-doc-exa13.tex 1275 2026-06-03 13:31:25Z herbert $

\begin{externalDocument}[
  compiler=lualatex, runs=1, crop,
  %xindex, xindexOptions={-l DE --config AU},
  %mpwidth=0.6\linewidth, 
  usefancyvrb=false,
  docType=latex,
]{voss}
\DocumentMetadata{}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}
\usepackage{pst-hyperboloid}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}(-8,-7)(8,7)
\psset{solidmemory,viewpoint=100 60 20 rtp2xyz,lightsrc=viewpoint,Decran=100}
\pstVerb{/Hauteur 8 def           /nEtages 36 def
         /Pas 1 nEtages div def   /nMeridiens 36 def
         /DemiAxeFocal 1 def % rayon de l'étranglement au milieu
         /RayonBases 3 def
         /DemiAxeNonFocal Hauteur 2 div RayonBases dup mul DemiAxeFocal dup mul sub sqrt div DemiAxeFocal mul def
         /xMax DemiAxeNonFocal DemiAxeFocal mul DemiAxeNonFocal dup mul DemiAxeFocal dup mul sub sqrt div def
         /GrandAxe xMax 2 sqrt mul def   /ConeAsymptote DemiAxeFocal DemiAxeNonFocal div def
}%
\psSolid[object=grille,base=-3 3 -3 3,linewidth=0.5\pslinewidth,linecolor=red](0,0,Hauteur 2 div neg)%
\psSolid[object=new,fillcolor=red!50,incolor=yellow,%hollow,
  action=draw*,sommets=
    0.5 Pas neg -0.5 Pas neg add{
  	  /k exch def
	  0 1 nMeridiens 1 sub {
    	/i exch def
    	/r 4 k dup mul mul RayonBases dup mul DemiAxeFocal dup mul sub mul DemiAxeFocal dup mul add sqrt def
    	360 nMeridiens idiv i mul cos r mul
    	360 nMeridiens idiv i mul sin r mul
    	k Hauteur mul
	  } for
  } for, faces={
	0 1 nEtages 1 sub {
	  /k1 exch def
	  k1 nMeridiens mul 1 add 1 k1 1 add nMeridiens mul 1 sub {
		/i exch def
		[i i 1 sub nMeridiens i add 1 sub nMeridiens i add]
	  } for
	  [k1 nMeridiens mul k1 1 add nMeridiens mul 1 sub k1 2 add nMeridiens mul 1 sub k1 1 add nMeridiens mul]
	} for
	% faces du dessus et de dessous
	%[0 1 nMeridiens 1 sub {}for]
	%[nMeridiens nEtages 1 add mul 1 sub -1  nMeridiens nEtages mul {}for ]
  }, plansepare={[0 1 ConeAsymptote 0]},name=coupeHyperboloidTest,action=none]
\psSolid[object=load,incolor=yellow!50,fillcolor=ForestGreen!20, linewidth=0.5\pslinewidth,
  rm=0,% intersectionplan={[0 1 ConeAsymptote 0]}, intersectioncolor=(bleu),
  %         intersectionlinewidth=2,intersectiontype=0,
           load=coupeHyperboloidTest1,hollow=true](0,0,0)
\defFunction[algebraic]{ellipse}(t){DemiAxeFocal*cos(t)}{GrandAxe*sin(t)}{}
\psSolid[object=plan,definition=equation,args={[0 1 ConeAsymptote 0] 180},linecolor=red,
   fillcolor=Aquamarine,planmarks,base=-3 3 -4.9 4.9,showBase,action=draw]%
\psSolid[object=plan, definition=equation,args={[0 1 ConeAsymptote 0] 180},base=-5 5 -4.9 4.9,
   action=none,name=monplan]%
\psProjection[object=droite,plan=monplan,linewidth=3\pslinewidth,linecolor=red,args=1 5 1 -5]
\psProjection[object=droite,linewidth=3\pslinewidth,plan=monplan,linecolor=red,args=-1 5 -1 -5]
\composeSolid
%\psPoint(0,DemiAxeFocal,0){F}\psdot(F)
%\psPoint(xMax neg,0,xMax){F2}\psdot[linecolor=red](F2)
\gridIIID[Zmin=-4,Zmax=4,linewidth=1\pslinewidth](-3,3)(-3,3)
\end{pspicture}
\end{document}
\end{externalDocument}
