%% $Id: pst-hyperboloid-doc-exa10.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=50 30 20 rtp2xyz,lightsrc=viewpoint,Decran=50,resolution=200}
\pstVerb{/Hauteur 8 def         /nEtages 20 def
         /Pas 1 nEtages div def /nMeridiens 36 def
         /DemiAxeFocal 1 def % rayon de l'étranglement au milieu
         /RayonBases 4 def
         /DemiAxeNonFocal Hauteur 2 div RayonBases dup mul DemiAxeFocal dup mul sub sqrt div DemiAxeFocal mul def
         /X0 0.5 def  /Y0 DemiAxeFocal 1 X0 DemiAxeFocal div dup mul sub sqrt mul def
         /Ymax RayonBases def}%
\psSolid[object=grille,base=-4 4 -4 4,linewidth=0.5\pslinewidth](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 div i mul cos r mul
    	  360 nMeridiens div i mul sin r mul
    	  k Hauteur mul
	  	} for
	  } for
	  0 1 nMeridiens 1 sub {/J exch def
        RayonBases 360 nMeridiens div J mul cos mul
        RayonBases 360 nMeridiens div J mul sin mul
    	Hauteur 2 div } 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},
  plansepare={[1 0 0 -0.5]},name=coupeHyperboloidTest, action=none]
\psSolid[object=load,incolor=yellow!50,fillcolor=ForestGreen!20,linewidth=0.5\pslinewidth,
         rm=0 1,%numfaces=all,%rm=0,
         % intersectionplan={[1 0 0 -0.5]},
         % intersectioncolor=(bleu),
         % intersectionlinewidth=2,
         % intersectiontype=0,
         load=coupeHyperboloidTest1]
\defFunction[algebraic]{hyperbol3}(t){X0}{t}{DemiAxeNonFocal*sqrt((t^2+X0^2)/(DemiAxeFocal^2)-1)}
\defFunction[algebraic]{hyperbol4}(t){X0}{t}{-DemiAxeNonFocal*sqrt((t^2+X0^2)/(DemiAxeFocal^2)-1)}
\psSolid[object=courbe,linewidth=2\pslinewidth,function=hyperbol3,range=Y0 neg -4,r=0,linecolor=red]%
\psSolid[object=courbe,linewidth=2\pslinewidth,function=hyperbol3,range=Y0 4,r=0,linecolor=red]%
\psSolid[object=courbe,linewidth=2\pslinewidth,function=hyperbol4,range=Y0 4,r=0,linecolor=red]%
\psSolid[object=courbe,linewidth=2\pslinewidth,function=hyperbol4,range=Y0 neg -4,r=0,linecolor=red]%
\psSolid[object=plan, definition=equation,args={[1 0 0 -0.5] 90},linecolor=red,
   planmarks, base=-4 4 -4 4, showBase,action=draw ]
\gridIIID[Zmin=-4,Zmax=4](-4,4)(-4,4)
%\psPoint(X0,Y0,0){P}\psdot(P)
\end{pspicture}
\end{document}
\end{externalDocument}
