#
# kihonc.rb
#   $Id: kihonc.rb,v 1.2 2000/11/18 19:03:34 keiko Exp $
#


require "narray"
require "numru/dcl"
include NumRu
include Math


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

DCL::sgfrm

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

#-- デフォルト ----
y1 = 9.0
for i in 1..8
  x1 = i
  x2 = x1 + 0.1*i
  y2 = y1 + 0.1*i
  DCL::sglau(x1, y1, x2, y2)
end

#-- 線分のラインタイプ ----
y1 = 8.0
y2 = 8.6
for i in 1..4
  x1 = 2*i - 1
  x2 = x1 + 0.6
  DCL::sgslat(i)
  DCL::sglau(x1, y1, x2, y2)
end

DCL::sgslat(1)

#-- 線分のラインインデクス ----
y1 = 7.0
y2 = 7.6
for i in 1..4
  x1 = 2*i
  x2 = x1 + 0.6
  DCL::sgslai(i)
  DCL::sglau(x1, y1, x2, y2)
end

DCL::sgslai(1)

#-- 矢じり部分の長さ ----
DCL::sglset('LPROP', false)
DCL::sgrset('CONST', 0.03)

y1 = 6.0
for i in 1..8
  x1 = i
  x2 = x1 + 0.1*i
  y2 = y1 + 0.1*i
  DCL::sglau(x1, y1, x2, y2)
end

DCL::sglset('LPROP', true)

#-- 矢じり部分の角度 ----
y1 = 5.0
y2 = 5.6
for i in 1..8
  x1 = i
  x2 = x1 + 0.6
  DCL::sgrset('ANGLE', 10.0*i)
  DCL::sglau(x1, y1, x2, y2)
end

#-- 矢じり部分のぬりつぶし ----
DCL::sglset('LSOFTF', true)
DCL::sglset('LATONE', true)
DCL::sgiset('IATONE', 655)

y1 = 4.0
y2 = 4.6
for i in 1..8
  x1 = i
  x2 = x1 + 0.6
  DCL::sgrset('ANGLE', 10.0*i)
  DCL::sglau(x1, y1, x2, y2)
end

#-- ラインサブプリミティブ ----
#-- デフォルト ----
DCL::sglnu(0.0, 3.0, 10.0, 3.0)

#-- 線分のラインインデクス ----
y1 = 0.5
y2 = 2.5
for i in 1..4
  x1 = 2*i - 1
  x2 = x1 + 2.0
  DCL::sgslni(i)
  DCL::sglnu(x1, y1, x2, y2)
end

DCL::sgcls



syntax highlighted by Code2HTML, v. 0.9.1