6角形

 投稿者:しばっち  投稿日:2016年 3月12日(土)09時17分42秒
  DIM X(3),Y(3),XX(3),YY(3)
LET XSIZE=800
LET YSIZE=800
CALL GINIT(XSIZE,YSIZE)
SET LINE COLOR 7
LET A=1
LET B=9
FOR J=90 TO 450 STEP 60
   LET X1=XSIZE/2+XSIZE/2*COS(RAD(J))
   LET Y1=YSIZE/2-YSIZE/2*SIN(RAD(J))
   LET X2=XSIZE/2+XSIZE/2*COS(RAD(J+60))
   LET Y2=YSIZE/2-YSIZE/2*SIN(RAD(J+60))
   LET X(2)=X1
   LET Y(2)=Y1
   LET X(3)=X2
   LET Y(3)=Y2
   LET X(1)=XSIZE/2
   LET Y(1)=YSIZE/2
   MAT PLOT LINES:X,Y
   SWAP A,B
   DO
      FOR I=1 TO 3
         LET XX(I)=(A*X(I)+B*X(MOD(I,3)+1))/(A+B)
         LET YY(I)=(A*Y(I)+B*Y(MOD(I,3)+1))/(A+B)
         PLOT LINES:XX(I),YY(I);
      NEXT I
      PLOT LINES:XX(1),YY(1)
      MAT X=XX
      MAT Y=YY
   LOOP UNTIL SQR((X(2)-X(1))^2+(Y(2)-Y(1))^2)<20
NEXT J
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
SET COLOR MIX(8) 58/255,110/255,165/255
SET COLOR MIX(9) 212/255,208/255,200/255
CLEAR
END SUB
 

戻る