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

require "narray"
require "numru/dcl"

include NumRu
include Math


#-- data ---
ux = NArray[2.0, 4.0, 5.0, 7.0, 8.0]
uy = NArray[4.0, 5.0, 4.0, 5.0, 4.0]
vx = NArray[0.2, 0.4, 0.5, 0.7, 0.8]
vy = NArray[0.5, 0.6, 0.5, 0.6, 0.5]

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

#     TEST POLYLINE, POLYMARKER, TEXT PRIMITIVE IN WC.
#     TEST POLYLINE, POLYMARKER, TEXT PRIMITIVE IN NDC.
#     TRANSFORMATION FUNCTION : LINEAR*LINEAR
#     NO-CLIPPING, FONT NO.=1
DCL::sgfrm
DCL::sgiset('IFONT', 1)
DCL::sgswnd(0.0, 10.0, 0.0, 10.0)
DCL::sgsvpt(0.0, 1.0, 0.0, 1.0)
DCL::sgstrn(1)
DCL::sgstrf

DCL::sglnzu(0.1, 0.1, 9.9, 0.1, 1)
DCL::sglnzu(9.9, 0.1, 9.9, 9.9, 1)
DCL::sglnzu(9.9, 9.9, 0.1, 9.9, 1)
DCL::sglnzu(0.1, 9.9, 0.1, 0.1, 1)

DCL::sgplzu(ux, uy, 2, 3)
DCL::sgpmzu(ux, uy, 5, 3, 0.04)
vx1, vy1 = DCL::stftrf(ux[0], uy[0])
vx2, vy2 = DCL::stftrf(ux[3], uy[3])
DCL::sglnzv(vx1, vy1, vx2, vy2, 2)
DCL::sgtxzu(5.0, 8.5, 'TESTU', 0.1, 0, 0, 3)

DCL::sgswnd(2.5, 7.5, 2.5, 7.5)
DCL::sgsvpt(0.25, 0.75, 0.25, 0.75)
DCL::sgstrn(1)
DCL::sgstrf

DCL::sgplzv(vx, vy, 3, 1)
DCL::sgpmzv(vx, vy, 4, 1, 0.02)
DCL::sgtxzv(0.5, 0.75, 'TESTV', 0.1, 0, 0, 3)

#     TEST POLYLINE, POLYMARKER, TEXT PRIMITIVE IN WC.
#     TEST POLYLINE, POLYMARKER, TEXT PRIMITIVE IN NDC.
#     TRANSFORMATION FUNCTION : LINEAR*LINEAR
#     CLIPPING, FONT NO.=2
DCL::sgfrm
DCL::sgiset('IFONT', 2)
DCL::sgswnd(0.0, 10.0, 0.0, 10.0)
DCL::sgsvpt(0.0, 1.0, 0.0, 1.0)
DCL::sgstrn(1)
DCL::sgstrf

DCL::sglnzu(0.1, 0.1, 9.9, 0.1, 1)
DCL::sglnzu(9.9, 0.1, 9.9, 9.9, 1)
DCL::sglnzu(9.9, 9.9, 0.1, 9.9, 1)
DCL::sglnzu(0.1, 9.9, 0.1, 0.1, 1)

DCL::sgplzu(ux, uy, 2, 3)
DCL::sgpmzu(ux, uy, 5, 3, 0.04)
vx1, vy1 = DCL::stftrf(ux[0], uy[0])
vx2, vy2 = DCL::stftrf(ux[3], uy[3])
DCL::sglnzv(vx1, vy1, vx2, vy2, 2)
DCL::sgtxzu(5.0, 8.5, 'TESTU', 0.1, 0, 0, 3)

DCL::sgswnd(2.5, 7.5, 2.5, 7.5)
DCL::sgsvpt(0.25, 0.75, 0.25, 0.75)
DCL::sgstrn(1)
DCL::sgstrf

DCL::sglset('LCLIP', true)
DCL::slpvpr(1)
DCL::sgplzv(vx, vy, 3, 1)
DCL::sgpmzv(vx, vy, 4, 1, 0.02)
DCL::sgtxzv(0.5, 0.75, 'TESTV', 0.1, 0, 0, 3)

DCL::sgcls
