# # sgpk06.rb # # $Id: sgpk06.rb,v 1.1 2000/11/21 03:02:08 keiko Exp $ # require "narray" require "numru/dcl" include NumRu include Math n = 37 x = NArray.sfloat(n) y = NArray.sfloat(n) #-- data --- dt = 2.0* 3.14159 / (n-1) r = 0.2 for i in 0..n-1 x[i] = r*sin(dt*i) + 0.5 y[i] = r*cos(dt*i) + 0.5 end xc = 0.5 yc = 0.5 #-- graph --- iws = (ARGV[0] || (puts ' WORKSTATION ID (I) ? ;'; DCL::sgpwsn; gets)).to_i DCL::sgopn iws #----------------------------- page 1 --------------------------------- DCL::sgfrm DCL::sgstxi(3) DCL::sgspli(2) # xmin, xmax, ymin, ymax DCL::sgswnd(0.0, 1.0, 0.0, 1.0) DCL::sgsvpt(0.0, 1.0, 0.0, 1.0) DCL::sgstrn(1) DCL::sgstrf DCL::slpvpr(1) DCL::sgplu(x, y) # <-- 円描画 DCL::sgtxu(xc, yc, 'SGTXU') # <-- テキスト #----------------------------- page 2 --------------------------------- DCL::sgfrm # xmin, xmax, ymin, ymax DCL::sgswnd(0.0, 1.0, 0.0, 1.0) # <-- 1x1 DCL::sgsvpt(0.1, 0.4, 0.6, 0.9) # <-- 小さなview port DCL::sgstrn(1) DCL::sgstrf DCL::slpvpr(1) DCL::sgplu(x, y) # <-- 円描画 DCL::sgtxu(xc, yc, 'SGTXU') # <-- テキスト # xmin, xmax, ymin, ymax DCL::sgswnd(0.0, 1.0, 0.3, 0.7) # <-- ゆがんだwindow DCL::sgsvpt(0.6, 0.9, 0.6, 0.9) DCL::sgstrn(1) DCL::sgstrf DCL::slpvpr(1) DCL::sgplu(x, y) # <-- 円描画 DCL::sgtxu(xc, yc, 'SGTXU') # <-- テキスト # xmin, xmax, ymin, ymax DCL::sgswnd(0.0, 1.0, -0.5, 0.5) # <-- はみ出し window DCL::sgsvpt(0.1, 0.4, 0.1, 0.4) DCL::sgstrn(1) DCL::sgstrf DCL::slpvpr(1) DCL::sgplu(x, y) # <-- 円描画 DCL::sgtxu(xc, yc, 'SGTXU') # <-- テキスト DCL::sglset('LCLIP', true) # <-- クリッピング # xmin, xmax, ymin, ymax DCL::sgswnd(0.0, 1.0, -0.5, 0.5) DCL::sgsvpt(0.6, 0.9, 0.1, 0.4) DCL::sgstrn(1) DCL::sgstrf DCL::slpvpr(1) DCL::sgplu(x, y) # <-- 円描画 DCL::sgtxu(xc, yc, 'SGTXU') # <-- テキスト DCL::sgcls