= #JxnPortable\docs\gallery\SchneckeStereo.jxn
!
#ifndef owner
one = true
two = true
#else if not or( $this.isDefined "one", $this.isDefined "two" )
one = "one".equals owner.getParameter( "nViews" )
two = "two".equals owner.getParameter( "nViews" )
#endif
#ifndef one
one = false
#endif
#ifndef two
two = false
#endif
#JXN:include/SliderInclude.jxn
d = slider.add( "d", 0.5, 0., 5. )
! d = eye distance
p3d_dz = slider.add( "dz", 100., 0.1, 10000. )
p3d_alpha = slider.add( "alpha", 19.4712,  -90.,  90. )
p3d_phi   = slider.add( "phi",  -20.7048, -180., 180. )
p3dLeft = @KmgPerspectiveProjection( p3d_phi, p3d_alpha, p3d_dz, -d )
p3dRght = @KmgPerspectiveProjection( p3d_phi, p3d_alpha, p3d_dz, +d )
!
tt = slider.add( "tt", 1.5, 0., 3. )
uv = @JxnUVGrid( 0, 360, 30., 0, 720, 15., 2 )
R = 3
phi = uv.u()
r =     tt uv.v() / 720
theta = tt uv.v() / 2
x = ( R + r cosD phi ) cosD theta
y = ( R + r cosD phi ) sinD theta
z =       r sinD phi
!
#if two
pf1 = plot( p3dLeft, 0. ).add( x-d, y, z ).setPlotFrameTitle( "side-by-side stereoscopy: left eye" )
!.setAuto( false, true )
pf2 = plot( p3dRght, 0. ).add( x+d, y, z ).setPlotFrameTitle( "side-by-side stereoscopy: right eye" )
!.setAuto( false, true )
#JXN:include/Grid2Include.jxn
#endif
#if one
leftColor = Color.CYAN
rghtColor = Color.RED
pf1 = plot( p3dRght, 0. ).add( curve( x, y, z, p3dLeft, leftColor, 0 ) ).add( curve( x, y, z, p3dRght, rghtColor, 0 ) )
pf1.setPlotFrameTitle( "color anaglyph 3D glasses: left eye red, right eye cyan" ).setAutoScale(2)
#JXN:include/Center1Include.jxn
#endif