マスク画像サンプル

 投稿者:しばっち  投稿日:2015年 5月30日(土)22時12分10秒
  !'自由形変換で使用するマスク画像のサンプルを生成します
LET XSIZE=600 !'生成画像サイズ
LET YSIZE=600
CALL GINIT(XSIZE,YSIZE)
LET XX=XSIZE/2
LET YY=YSIZE/2
LET R=MIN(XX,YY)
CALL CIRCLEFULL(XX,YY,R,R,7)
CALL SAVE
CALL CIRCLEFULL(XX,YY,R,R/2,7)
CALL SAVE
CALL CIRCLEFULL(XX,YY,R/2,R,7)
CALL SAVE
CALL CIRCLEFULL(XX,YY,R,R,7)
CALL CIRCLEFULL(XX,YY,R*.3,R*.3,0)
CALL SAVE
FOR I=2 TO 4
   FOR T=0 TO 359 STEP 360/I
      LET X=XX+R/3*COS(RAD(T))
      LET Y=YY+R/3*SIN(RAD(T))
      CALL CIRCLEFULL(X,Y,R/1.5,R/1.5,7)
   NEXT T
   CALL SAVE
NEXT I
CALL SECTOR(XX,YSIZE,YSIZE,60,7)
CALL SAVE
CALL SECTOR(XX,YSIZE+YSIZE/4,YSIZE,60,7)
CALL SECTOR(XX,YSIZE+YSIZE/4,YSIZE/3,60,0)
CALL SAVE
FOR I=3 TO 6
   CALL POLY(XX,YY,R,7,90,450,360/I)
   PAINT XX,YY
   CALL SAVE
NEXT I
CALL POLY(XX,YY,R*.99,7,90,90+360*2,144)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*3,135)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*3,108)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*4,160)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*4,96)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*5,150)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*5,100)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*7,84)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*7,105)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*7,126)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*7,140)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*7,168)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*9,162)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*9,108)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*9,81)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*11,132)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*11,110)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*11,165)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*11,99)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*11,88)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*13,104)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*13,117)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*13,130)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*13,156)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*13,78)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*14,112)
CALL TRANS
CALL POLY(XX,YY,R*.99,7,90,90+360*16,128)
CALL TRANS
CALL CIRCLEFULL(XX,YY,R,R,7)
CALL CIRCLEFULL(XX+XX/2,YY,R,R,0)
CALL SAVE
DIM XO(10),YO(10)
SET AREA COLOR 7
LET XO(1)=XSIZE/3
LET YO(1)=YSIZE/3
LET XO(2)=0
LET YO(2)=YSIZE-1
LET XO(3)=XSIZE-1
LET YO(3)=YSIZE-1
LET XO(4)=XSIZE/3*2
LET YO(4)=YSIZE/3
MAT PLOT AREA,LIMIT 4:XO,YO
CALL SAVE
LET XO(1)=XSIZE/3
LET YO(1)=0
LET XO(2)=XSIZE/3*2
LET YO(2)=0
LET XO(3)=XSIZE/3*2
LET YO(3)=YSIZE-1
LET XO(4)=XSIZE/3
LET YO(4)=YSIZE-1
MAT PLOT AREA,LIMIT 4:XO,YO
CALL SAVE
LET XO(1)=0
LET YO(1)=YSIZE/3
LET XO(2)=0
LET YO(2)=YSIZE/3*2
LET XO(3)=XSIZE-1
LET YO(3)=YSIZE/3*2
LET XO(4)=XSIZE-1
LET YO(4)=YSIZE/3
MAT PLOT AREA,LIMIT 4:XO,YO
CALL SAVE
LET XO(1)=XSIZE/3
LET YO(1)=YSIZE/3
LET XO(2)=XSIZE/3
LET YO(2)=YSIZE/3*2
LET XO(3)=XSIZE-1
LET YO(3)=YSIZE-1
LET XO(4)=XSIZE-1
LET YO(4)=0
MAT PLOT AREA,LIMIT 4:XO,YO
CALL SAVE
LET XO(1)=XSIZE*.2
LET YO(1)=0
LET XO(2)=XSIZE*.8
LET YO(2)=0
LET XO(3)=XSIZE*.8
LET YO(3)=YSIZE-1
LET XO(4)=XSIZE*.2
LET YO(4)=YSIZE-1
MAT PLOT AREA,LIMIT 4:XO,YO
LET XO(1)=0
LET YO(1)=YSIZE*.2
LET XO(2)=XSIZE-1
LET YO(2)=YSIZE*.2
LET XO(3)=XSIZE-1
LET YO(3)=YSIZE*.8
LET XO(4)=0
LET YO(4)=YSIZE*.8
MAT PLOT AREA,LIMIT 4:XO,YO
CALL SAVE
CALL LINE(XSIZE/3*2,0,0,YSIZE/3*2,7)
CALL LINE(XSIZE,(YSIZE+1)/3,(XSIZE+1)/3,YSIZE,7)
PAINT XX,YY
CALL SAVE
LET XO(1)=XSIZE*.3
LET YO(1)=YSIZE*.1
LET XO(2)=XSIZE*.8
LET YO(2)=YSIZE*.2
LET XO(3)=XSIZE*.9
LET YO(3)=YSIZE*.8
LET XO(4)=XSIZE*.1
LET YO(4)=YSIZE*.9
MAT PLOT AREA,LIMIT 4:XO,YO
CALL SAVE
LET SIZE=40
FOR Y=0 TO YSIZE-1
   FOR X=0 TO XSIZE-1
      IF MOD(X,2*SIZE)<SIZE THEN LET C=7 ELSE LET C=0
      IF MOD(Y,2*SIZE)<SIZE THEN LET C=7-C
      CALL PSET(X,Y,C)
   NEXT X
NEXT Y
CALL SAVE
LET SIZE=50
LET RR=20
FOR Y=0 TO YSIZE-1+SIZE
   FOR X=0 TO XSIZE-1+SIZE
      LET X1=INT((X+SIZE/2)/SIZE)*SIZE
      LET Y1=INT((Y+SIZE/2)/SIZE)*SIZE
      IF (X-X1)^2+(Y-Y1)^2<RR^2 THEN  CALL PSET(X-SIZE/2,Y-SIZE/2,7) ELSE CALL PSET(X-SIZE/2,Y-SIZE/2,0)
   NEXT X
NEXT Y
CALL SAVE
DO !'画像検索で入手。原画像サイズ1024*1024 自作の専用プログラムにて2dot間隔でスキャン。データー化した。
   READ IF MISSING THEN EXIT DO:X,Y
   LET X1=X/1024*XSIZE
   LET Y1=Y/1024*YSIZE
   IF XS=0 THEN
      LET XS=X1
      LET YS=Y1
   END IF
   CALL LINE(XS,YS,X1,Y1,7)
   LET XA=(1023-X)/1024*XSIZE
   LET YA=Y/1024*YSIZE
   IF XB=0 THEN
      LET XB=XA
      LET YB=YA
   END IF
   CALL LINE(XA,YA,XB,YB,7)
   LET XS=X1
   LET YS=Y1
   LET XB=XA
   LET YB=YA
LOOP
PAINT XSIZE/2,YSIZE/2
DATA 512,324,510,322,508,320,506,318,504,316,502,312,500,310,498,308,496,306,494,304,492,302,490,300,488,298,486,294,484,292,482,290,480,288,478,286,476,286,474,284,472,282,470,280,468,278,466,276
DATA 464,274,462,272,460,270,458,268,456,268,454,266,452,264,450,262,448,260,446,260,444,258,442,256,440,256,438,254,436,252,434,252,432,250,430,248,428,248,426,246,424,246,422,244,420,242,418,242,416,240
DATA 414,240,412,238,410,238,408,238,406,236,404,236,402,234,400,234,398,232,396,232,394,232,392,230,390,230,388,230,386,228,384,228,382,228,380,228,378,226,376,226,374,226,372,226,370,224,368,224,366,224
DATA 364,224,362,224,360,224,358,224,356,222,354,222,352,222,350,222,348,222,346,222,344,222,342,222,340,222,338,222,336,222,334,222,332,222,330,222,328,222,326,222,324,222,322,224,320,224,318,224,316,224
DATA 314,224,312,224,310,226,308,226,306,226,304,226,302,228,300,228,298,228,296,228,294,230,292,230,290,230,288,230,286,232,284,232,282,234,280,234,278,234,276,236,274,236,272,238,270,238,268,240,266,240
DATA 264,242,262,242,260,244,258,244,256,246,254,246,252,248,250,248,248,250,246,252,244,252,242,254,240,256,238,258,236,258,234,260,232,262,230,264,228,266,226,268,224,270,222,272,220,274,218,276,216,278
DATA 214,280,212,284,210,286,208,288,206,292,204,294,202,298,200,300,198,304,196,308,194,312,192,316,190,322,188,326,186,332,184,340,182,348,180,358,178,374
DATA 178,386,178,388,178,390,178,392,178,394,178,396,178,398,178,400,178,402,178,404,178,406,178,408,178,410,178,412,178,414,179,416,179,418,179,420,179,422,179,424,180,426,180,428,180,430,181,432
DATA 181,434,181,436,182,438,182,440,183,442,183,444,183,446,184,448,184,450,185,452,186,454,186,456,186,458,187,460,188,462,188,464,189,466,189,468,190,470,191,472,191,474,192,476,193,478,194,480,194,482
DATA 195,484,196,486,197,488,197,490,198,492,199,494,200,496,201,498,202,500,203,502,204,504,205,506,206,508,207,510,208,512,209,514,210,516,211,518,212,520,213,522,214,524,216,526,217,528,218,530,219,532
DATA 220,534,222,536,223,538,224,540,226,542,227,544,228,546,230,548,231,550,232,552,234,554,235,556,236,558,238,560,239,562,241,564,242,566,243,568,245,570,246,572,248,574,249,576,251,578,252,580,254,582
DATA 255,584,257,586,258,588,260,590,261,592,263,594,265,596,266,598,268,600,269,602,271,604,272,606,274,608,276,610,277,612,279,614,281,616,282,618,284,620,286,622,287,624,289,626,291,628,292,630,294,632
DATA 296,634,297,636,299,638,300,640,302,642,304,644,306,646,308,648,309,650,311,652,313,654,314,656,316,658,318,660,320,662,321,664,323,666,325,668,327,670,329,672,330,674,332,676,334,678,336,680,337,682
DATA 339,684,341,686,343,688,345,690,347,692,348,694,350,696,352,698,354,700,356,702,358,704,359,706,361,708,363,710,365,712,367,714,369,716,371,718,372,720,374,722,376,724,378,726,380,728,382,730,384,732
DATA 386,734,388,736,389,738,391,740,393,742,395,744,397,746,399,748,401,750,403,752,405,754,407,756,409,758,410,760,412,762,414,764,416,766,418,768,420,770,422,772,424,774,426,776,428,778,430,780,431,782
DATA 433,784,435,786,437,788,439,790,441,792,443,794,445,796,447,798,449,800,450,802,452,804,454,806,456,808,458,810,460,812,462,814,464,816,466,818,468,820,470,822,471,824,473,826,475,828,477,830,479,832
DATA 481,834,483,836,485,838,487,840,489,842,491,844,492,846,494,848,496,850,498,852,500,854,502,856,504,858,506,860,508,862,510,864,511,866
CALL SAVE
FOR I=1 TO 5
   SELECT CASE I
   CASE 1
      LET M=.5
   CASE 2
      LET M=.8
   CASE 3
      LET M=1.5
   CASE 4
      LET M=3
   CASE 5
      LET M=8
   END SELECT
   FOR Y=0 TO YSIZE-1
      FOR X=0 TO XSIZE-1
         IF ABS((X-XX)/XX)^M+ABS((Y-YY)/YY)^M<1 THEN CALL PSET(X,Y,7)
      NEXT X
   NEXT Y
   CALL SAVE
NEXT I
FOR I=1 TO 5
   IF I=1 THEN LET M=3 ELSE LET M=M+1
   FOR Y=0 TO YSIZE-1
      FOR X=0 TO XSIZE-1
         IF X=XX AND Y=YY THEN LET TH=0 ELSE LET TH=ANGLE(X-XX,Y-YY)
         LET RR=R*.8+R*.2*COS(M*TH)
         IF SQR((Y-YY)^2+(X-XX)^2)<RR THEN CALL PSET(X,Y,7)
      NEXT X
   NEXT Y
   CALL SAVE
NEXT I
LET RR=XSIZE/4
LET TH=0
FOR I=1 TO 3
   IF I=1 THEN LET B=2 ELSE LET B=3
   IF I=3 THEN LET TH=180
   FOR Y=0 TO YSIZE-1
      LET X1=RR/2+RR/2*SIN(RAD(B*Y))
      LET X2=XSIZE-RR/2+RR/2*SIN(RAD(B*Y+TH))
      FOR X=INT(X1) TO INT(X2)
         CALL PSET(X,Y,7)
      NEXT X
   NEXT Y
   CALL SAVE
NEXT I
FOR I=1 TO 2
   FOR Y=0 TO YSIZE-1
      LET X1=XSIZE/4*SIN(RAD(Y/(YSIZE/180)))
      IF I=2 THEN
         LET X2=XSIZE-XSIZE/4*SIN(RAD(Y/(YSIZE/180)))
      ELSE
         LET X2=XSIZE*.75+XSIZE/4*SIN(RAD(Y/(YSIZE/180)))
      END IF
      FOR X=INT(X1) TO INT(X2)
         CALL PSET(X,Y,7)
      NEXT X
   NEXT Y
   CALL SAVE
NEXT I
FOR I=1 TO 2
   FOR X=0 TO XSIZE-1
      LET Y1=YSIZE/4+YSIZE/4*SIN(RAD(X/(XSIZE/180)+180))
      IF I=2 THEN
         LET Y2=YSIZE*.75-YSIZE/4*SIN(RAD(X/(XSIZE/180)+180))
      ELSE
         LET Y2=YSIZE+YSIZE/4*SIN(RAD(X/(XSIZE/180)+180))
      END IF
      FOR Y=INT(Y1) TO INT(Y2)
         CALL PSET(X,Y,7)
      NEXT  Y
   NEXT  X
   CALL SAVE
NEXT I
FOR Y=0 TO YSIZE-1
   LET X1=XSIZE/4+R/2*SIN(RAD(Y/(YSIZE/180)+180))
   LET X2=XSIZE*.75-XSIZE/4*SIN(RAD(Y/(YSIZE/180)+180))
   FOR X=INT(X1) TO INT(X2)
      CALL PSET(X,Y,7)
   NEXT X
NEXT Y
CALL SAVE
FOR Y=0 TO YSIZE-1
   FOR X=0 TO XSIZE-1
      IF X=XX AND Y=YY THEN LET TH=0 ELSE LET TH=ANGLE(X-XX,Y-YY)
      LET RR=MIN(XSIZE/5,YSIZE/5)*(1+COS(5*TH+PI/2))
      IF SQR((Y-YY)^2+(X-XX)^2)<RR THEN CALL PSET(X,Y,7)
   NEXT X
NEXT Y
CALL SAVE
FOR Y=0 TO YSIZE-1
   FOR X=0 TO XSIZE-1
      IF X=XX AND Y=YY THEN LET TH=0 ELSE LET TH=ANGLE(X-XX,Y-YY)
      LET RR=MIN(XSIZE/6,YSIZE/6)*(2+COS(5*TH))
      IF SQR((Y-YY)^2+(X-XX)^2)<RR THEN CALL PSET(X,Y,7)
   NEXT X
NEXT Y
CALL SAVE
FOR Y=0 TO YSIZE-1
   FOR X=0 TO XSIZE-1
      IF ((X-XX)*(X-XX)+SQR(2)*(X-XX)*(Y-YY)+(Y-YY)*(Y-YY)-R/2*R/2)<0 OR ((X-XX)*(X-XX)-SQR(2)*(X-XX)*(Y-YY)+(Y-YY)*(Y-YY)-R/2*R/2)<0 THEN CALL PSET(X,Y,7)
   NEXT X
NEXT Y
CALL SAVE
FOR I=2 TO 5
   CALL NAMI(XX,YY,R*.6,R/4,I,7)
   PAINT XX,YY
   CALL SAVE
NEXT I
CALL NAMI(XX,YY,R*.9,20,20,7)
PAINT XX,YY
CALL SAVE
CALL HAGURUMA(XX,YY,R*.9,20,20,7)
PAINT XX,YY
CALL SAVE
LET XO(1)=0
LET YO(1)=0
LET XO(2)=XX
LET YO(2)=YSIZE-1
LET XO(3)=XSIZE-1
LET YO(3)=0
LET X1=XO(1)
LET Y1=YO(1)
FOR X=0 TO XSIZE-1
   LET Y=LARGRANGE(XO,YO,3,X)
   CALL LINE(X1,Y1,X,Y,7)
   LET X1=X
   LET Y1=Y
NEXT  X
PAINT XX,YY
CALL SAVE
LET XO(1)=0
LET YO(1)=0
LET XO(2)=XSIZE/4
LET YO(2)=YSIZE-1
LET XO(3)=XX
LET YO(3)=YSIZE*.75
LET XO(4)=XSIZE*.75
LET YO(4)=YSIZE-1
LET XO(5)=XSIZE-1
LET YO(5)=0
LET X1=XO(1)
LET Y1=YO(1)
FOR X=0 TO XSIZE-1
   LET Y=LARGRANGE(XO,YO,5,X)
   CALL LINE(X1,Y1,X,Y,7)
   LET X1=X
   LET Y1=Y
NEXT  X
PAINT XX,YY
CALL SAVE
DIM TT(10)
LET XO(1)=0
LET YO(1)=0
LET TT(1)=0
LET XO(2)=XSIZE*.2
LET YO(2)=YY
LET TT(2)=.5
LET XO(3)=0
LET YO(3)=YSIZE-1
LET TT(3)=1
FOR T=0 TO 1 STEP 1/16
   LET X=LARGRANGE(TT,XO,3,T)
   LET Y=LARGRANGE(TT,YO,3,T)
   IF T=0 THEN
      LET X1=X
      LET Y1=Y
   END IF
   CALL LINE(X1,Y1,X,Y,7)
   CALL LINE(XSIZE-X1,Y1,XSIZE-X,Y,7)
   LET X1=X
   LET Y1=Y
NEXT  T
LET XO(1)=0
LET YO(1)=0
LET TT(1)=0
LET XO(2)=XX
LET YO(2)=YSIZE*.2
LET TT(2)=.5
LET XO(3)=XSIZE-1
LET YO(3)=0
LET TT(3)=1
FOR T=0 TO 1 STEP 1/16
   LET X=LARGRANGE(TT,XO,3,T)
   LET Y=LARGRANGE(TT,YO,3,T)
   IF T=0 THEN
      LET X1=X
      LET Y1=Y
   END IF
   CALL LINE(X1,Y1,X,Y,7)
   CALL LINE(X1,YSIZE-Y1,X,YSIZE-Y,7)
   LET X1=X
   LET Y1=Y
NEXT  T
PAINT XX,YY
CALL SAVE
SET TEXT HEIGHT MIN(XSIZE,YSIZE)*.8
SET TEXT COLOR 7
SET TEXT JUSTIFY "LEFT" , "TOP"
PLOT TEXT ,AT 0,0:"A"
CALL SAVE

SUB SAVE
   LET NUM=NUM+1
   GSAVE STR$(NUM)&".gif"
   PRINT NUM
   WAIT DELAY 1
   CLEAR
END SUB

SUB TRANS
   SET AREA COLOR 4
   PAINT 0,0
   FOR Y=0 TO YSIZE-1
      FOR X=0 TO XSIZE-1
         IF GETPOINT(X,Y)=4 THEN CALL PSET(X,Y,0) ELSE CALL PSET(X,Y,7)
      NEXT X
   NEXT Y
   CALL SAVE
END SUB
END

EXTERNAL SUB GINIT(XSIZE,YSIZE)
SET BITMAP SIZE XSIZE,YSIZE
SET WINDOW 0,XSIZE-1,YSIZE-1,0
SET POINT STYLE 1
SET COLOR MODE "REGULAR"
SET COLOR MIX(0) 0,0,0
SET COLOR MIX(1) 0,0,1
SET COLOR MIX(2) 1,0,0
SET COLOR MIX(3) 1,0,1
SET COLOR MIX(4) 0,1,0
SET COLOR MIX(5) 0,1,1
SET COLOR MIX(6) 1,1,0
SET COLOR MIX(7) 1,1,1
CLEAR
END SUB

EXTERNAL SUB POLY(X,Y,R,C,S,E,ST)
LET X0=X+R*COS(S*PI/180)
LET Y0=Y-R*SIN(S*PI/180)
FOR TH=S+ST TO E STEP ST
   LET X1=X+R*COS(TH*PI/180)
   LET Y1=Y-R*SIN(TH*PI/180)
   CALL LINE(X0,Y0,X1,Y1,C)
   LET X0=X1
   LET Y0=Y1
NEXT TH
END SUB

EXTERNAL SUB CIRCLEFULL(X,Y,R1,R2,C)
SET COLOR C
DRAW DISK WITH SCALE(R1,R2)*SHIFT(X,Y)
END SUB

EXTERNAL SUB SECTOR(XX,YY,R,A,C)
DIM XO(90-A/2 TO 90+A/2+1),YO(90-A/2 TO 90+A/2+1)
FOR T=90-A/2 TO 90+A/2
   LET XO(T)=XX+R*COS(RAD(T))
   LET YO(T)=YY-R*SIN(RAD(T))
NEXT T
LET XO(90+A/2+1)=XX
LET YO(90+A/2+1)=YY
SET AREA COLOR C
MAT PLOT AREA,LIMIT A+2:XO,YO
END SUB
 

Re: マスク画像サンプル

 投稿者:しばっち  投稿日:2015年 5月30日(土)22時13分4秒
  > No.3722[元記事へ]

続き

EXTERNAL SUB PSET(X,Y,C)
SET POINT COLOR C
PLOT POINTS:X,Y
END SUB

EXTERNAL FUNCTION GETPOINT(X,Y)
ASK PIXEL VALUE(X,Y) C
LET GETPOINT=C
END FUNCTION

EXTERNAL SUB LINE(XS,YS,XE,YE,C)
SET COLOR C
PLOT LINES
PLOT LINES:INT(XS),INT(YS);INT(XE),INT(YE)
END SUB

EXTERNAL SUB NAMI(X,Y,R,R1,N,C)
IF R<R1 THEN LET R1=R
FOR TH=0 TO 360
   LET R2=R1*SIN(N*TH*PI/180+PI/2)
   LET X1=X+(R+R2)*COS(TH*PI/180+PI/2)
   LET Y1=Y-(R+R2)*SIN(TH*PI/180+PI/2)
   IF TH=0 THEN
      LET X0=X1
      LET Y0=Y1
      LET XS=X0
      LET YS=Y0
   END IF
   CALL LINE(X0,Y0,X1,Y1,C)
   LET X0=X1
   LET Y0=Y1
NEXT TH
CALL LINE(X1,Y1,XS,YS,C)
END SUB

EXTERNAL SUB HAGURUMA(X,Y,R,R1,N,C)
IF R<R1 THEN LET R1=R
FOR TH=0 TO 360
   LET R2=R1*SGN(SIN(N*TH*PI/180+PI/2))
   LET X1=X+(R+R2)*COS(TH*PI/180+PI/2)
   LET Y1=Y-(R+R2)*SIN(TH*PI/180+PI/2)
   IF TH=0 THEN
      LET X0=X1
      LET Y0=Y1
      LET XS=X0
      LET YS=Y0
   END IF
   CALL LINE(X0,Y0,X1,Y1,C)
   LET X0=X1
   LET Y0=Y1
NEXT TH
CALL LINE(X1,Y1,XS,YS,C)
END SUB

EXTERNAL FUNCTION LARGRANGE(X(),Y(),N,T)
FOR I=1 TO N
   LET R=Y(I)
   FOR J=1 TO N
      IF I<>J THEN LET R=R*(T-X(J))/(X(I)-X(J))
   NEXT J
   LET S=S+R
NEXT I
LET LARGRANGE=S
END FUNCTION
 

戻る