#
# sgksx3.rb
#
# $Id: sgksx3.rb,v 1.1 2000/11/21 03:02:07 keiko Exp $
#

require "narray"
require "numru/dcl"

include NumRu
include Math


np = 100
ux = NArray.sfloat(np)
uy = NArray.sfloat(np)

#-- data ---
ux.indgen(1.0, 1.0)
for i in 1..np
  uy[i-1]=exp(-i*0.03)*sin(i*3.14/180*20)
end

#-- graph ---
iws = (ARGV[0] || (puts ' WORKSTATION ID (I)  ? ;'; DCL::sgpwsn; gets)).to_i
iws = iws.abs
DCL::sgopn iws

DCL::slrat(2.0, 1.0)
DCL::sldiv('Y', 2, 1)
DCL::slmgn(0.1, 0.1, 0.1, 0.1)

#     TEST POLYLINE, POLYMARKER, TEXT PRIMITIVE IN WC.
#     TEST POLYLINE, POLYMARKER, TEXT PRIMITIVE IN NDC.
#     TRANSFORMATION FUNCTION : LINEAR*LINEAR
DCL::sgfrm
DCL::sgswnd(1.0, np.to_f, -1.0, +1.0)
DCL::sgsvpt(0.1, 0.9, 0.1, 0.9)
DCL::sgstrn(1)
DCL::sgstrf

DCL::slpwwr(1)

DCL::sglnzu(1.0, 0.0, np.to_f, 0.0, 1)
DCL::sglnzu(1.0, -1.0, 1.0, +1.0, 1)

DCL::sgplzu(ux, uy, 2, 3)
DCL::sgpmzu(ux, uy, 5, 3, 0.02)
DCL::sgtxzv(0.5, 0.9, 'TEST1', 0.05, 0, 0, 3)

#     TEST POLYLINE, POLYMARKER, TEXT PRIMITIVE IN WC.
#     TEST POLYLINE, POLYMARKER, TEXT PRIMITIVE IN NDC.
#     TRANSFORMATION FUNCTION : LOG*LINEAR
DCL::sgfrm
DCL::sgswnd(1.0, np.to_f, -1.0, +1.0)
DCL::sgsvpt(0.1, 0.9, 0.1, 0.9)
DCL::sgstrn(3)
DCL::sgstrf

DCL::slpwwr(1)

DCL::gllset('LMISS', true)
DCL::sgiset('NPMSKIP', 2)
ux[ 4]=999.0
uy[19]=999.0

DCL::sglnzu(1.0, 0.0, np.to_f, 0.0, 1)
DCL::sglnzu(1.0, -1.0, 1.0, +1.0, 1)

DCL::sgplzu(ux, uy, 3, 3)
DCL::sgpmzu(ux, uy, 2, 3, 0.02)
DCL::sgtxzv(0.5, 0.9, 'TEST2', 0.05, 0, 0, 3)

DCL::sgcls

