Heart Curve

 投稿者:しばっち  投稿日:2015年10月28日(水)22時23分48秒
  http://mathworld.wolfram.com/HeartSurface.html

!'Heart Curve
SET WINDOW -3,3,-4.5,1.5
FOR T=0 TO 360
   LET R=2-2*SIN(RAD(T))+SIN(RAD(T))*SQR(ABS(COS(RAD(T))))/(SIN(RAD(T))+1.4)
   LET X=R*COS(RAD(T))
   LET Y=R*SIN(RAD(T))
   PLOT LINES:X,Y;
NEXT T
WAIT DELAY 2
CLEAR
SET WINDOW -20,20,-20,20
FOR T=0 TO 360
   LET X=16*SIN(RAD(T))^3
   LET Y=13*COS(RAD(T))-5*COS(RAD(2*T))-2*COS(RAD(3*T))-COS(RAD(4*T))
   PLOT LINES:X,Y;
NEXT T
END

-----------------------------------------------------------------------------------------------
!'Heart Surface
CALL GINIT(600,600)
SET WINDOW -2,2,-2,2
FOR Z=2 TO -2 STEP -1/256
   FOR X=-2 TO 2 STEP 1/256
      IF (X^2+Z^2-1)^3-X^2*Z^3<0 THEN CALL PSET(X,Z,7)
   NEXT X
NEXT  Z
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
SET COLOR 7
END SUB

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

戻る