|
!'ボクセル表現(VOXEL)
OPTION BASE 0
DIM ZZ(3),AA(3)
READ XS,XE,YS,YE,ZS,ZE,N
DATA 5,-5,5,-5,5,-5,20 !'(要)調整
FILE GETSAVENAME F$,"dxfファイル|*.dxf"
IF F$="" THEN STOP
IF POS(UCASE$(F$),".DXF")=0 THEN LET F$=F$ & ".dxf"
OPEN #1:NAME F$
ERASE #1
PRINT #1:"0"
PRINT #1:"SECTION"
PRINT #1:"2"
PRINT #1:"ENTITIES"
FOR Y=YS TO YE STEP (YE-YS)/N
FOR X=XS TO XE STEP (XE-XS)/N
FOR Z=ZS TO ZE STEP (ZE-ZS)/N
LET ZZ(0)=X
LET ZZ(1)=Y
LET ZZ(2)=Z
LET ZZ(3)=0
LET AA(0)=X
LET AA(1)=Y
LET AA(2)=Z
LET AA(3)=0
CALL MUL(ZZ,ZZ,AA) !'二乗の模様
CALL RECT(#1,ZZ(0),ZZ(1),ZZ(2),(XE-XS)/N,(YE-YS)/N,(ZE-ZS)/N)
NEXT Z
NEXT X
NEXT Y
PRINT #1:"0"
PRINT #1:"ENDSEC"
PRINT #1:"0"
PRINT #1:"EOF"
CLOSE #1
END
EXTERNAL SUB MUL(S(),A(),B()) !'クォータニオン(4元数)掛算
OPTION BASE 0
DIM SS(3)
LET SS(0)=A(0)*B(0)-A(1)*B(1)-A(2)*B(2)-A(3)*B(3)
LET SS(1)=A(0)*B(1)+A(1)*B(0)+A(2)*B(3)-A(3)*B(2)
LET SS(2)=A(0)*B(2)-A(1)*B(3)+A(2)*B(0)+A(3)*B(1)
LET SS(3)=A(0)*B(3)+A(1)*B(2)-A(2)*B(1)+A(3)*B(0)
MAT S=SS
END SUB
EXTERNAL SUB RECT(#1,XX,YY,ZZ,XL,YL,ZL)
LET X0=XX-XL/2
LET Y0=YY-YL/2
LET Z0=ZZ-ZL/2
LET X1=XX+XL/2
LET Y1=YY-YL/2
LET Z1=ZZ-ZL/2
LET X2=XX+XL/2
LET Y2=YY-YL/2
LET Z2=ZZ+ZL/2
LET X3=XX-XL/2
LET Y3=YY-YL/2
LET Z3=ZZ+ZL/2
LET X4=XX-XL/2
LET Y4=YY+YL/2
LET Z4=ZZ-ZL/2
LET X5=XX+XL/2
LET Y5=YY+YL/2
LET Z5=ZZ-ZL/2
LET X6=XX+XL/2
LET Y6=YY+YL/2
LET Z6=ZZ+ZL/2
LET X7=XX-XL/2
LET Y7=YY+YL/2
LET Z7=ZZ+ZL/2
PRINT #1:"0"
PRINT #1:"3DFACE"
PRINT #1:"8"
PRINT #1:"LAYER1"
PRINT #1:"62"
PRINT #1:"1"
PRINT #1:"10"
PRINT #1:X0
PRINT #1:"20"
PRINT #1:Y0
PRINT #1:"30"
PRINT #1:Z0
PRINT #1:"11"
PRINT #1:X3
PRINT #1:"21"
PRINT #1:Y3
PRINT #1:"31"
PRINT #1:Z3
PRINT #1:"12"
PRINT #1:X2
PRINT #1:"22"
PRINT #1:Y2
PRINT #1:"32"
PRINT #1:Z2
PRINT #1:"13"
PRINT #1:X1
PRINT #1:"23"
PRINT #1:Y1
PRINT #1:"33"
PRINT #1:Z1
PRINT #1:"0"
PRINT #1:"3DFACE"
PRINT #1:"8"
PRINT #1:"LAYER1"
PRINT #1:"62"
PRINT #1:"1"
PRINT #1:"10"
PRINT #1:X0
PRINT #1:"20"
PRINT #1:Y0
PRINT #1:"30"
PRINT #1:Z0
PRINT #1:"11"
PRINT #1:X1
PRINT #1:"21"
PRINT #1:Y1
PRINT #1:"31"
PRINT #1:Z1
PRINT #1:"12"
PRINT #1:X5
PRINT #1:"22"
PRINT #1:Y5
PRINT #1:"32"
PRINT #1:Z5
PRINT #1:"13"
PRINT #1:X4
PRINT #1:"23"
PRINT #1:Y4
PRINT #1:"33"
PRINT #1:Z4
PRINT #1:"0"
PRINT #1:"3DFACE"
PRINT #1:"8"
PRINT #1:"LAYER1"
PRINT #1:"62"
PRINT #1:"1"
PRINT #1:"10"
PRINT #1:X0
PRINT #1:"20"
PRINT #1:Y0
PRINT #1:"30"
PRINT #1:Z0
PRINT #1:"11"
PRINT #1:X3
PRINT #1:"21"
PRINT #1:Y3
PRINT #1:"31"
PRINT #1:Z3
PRINT #1:"12"
PRINT #1:X2
PRINT #1:"22"
PRINT #1:Y2
PRINT #1:"32"
PRINT #1:Z2
PRINT #1:"13"
PRINT #1:X1
PRINT #1:"23"
PRINT #1:Y1
PRINT #1:"33"
PRINT #1:Z1
PRINT #1:"0"
PRINT #1:"3DFACE"
PRINT #1:"8"
PRINT #1:"LAYER1"
PRINT #1:"62"
PRINT #1:"1"
PRINT #1:"10"
PRINT #1:X1
PRINT #1:"20"
PRINT #1:Y1
PRINT #1:"30"
PRINT #1:Z1
PRINT #1:"11"
PRINT #1:X2
PRINT #1:"21"
PRINT #1:Y2
PRINT #1:"31"
PRINT #1:Z2
PRINT #1:"12"
PRINT #1:X6
PRINT #1:"22"
PRINT #1:Y6
PRINT #1:"32"
PRINT #1:Z6
PRINT #1:"13"
PRINT #1:X5
PRINT #1:"23"
PRINT #1:Y5
PRINT #1:"33"
PRINT #1:Z5
PRINT #1:"0"
PRINT #1:"3DFACE"
PRINT #1:"8"
PRINT #1:"LAYER1"
PRINT #1:"62"
PRINT #1:"1"
PRINT #1:"10"
PRINT #1:X2
PRINT #1:"20"
PRINT #1:Y2
PRINT #1:"30"
PRINT #1:Z2
PRINT #1:"11"
PRINT #1:X3
PRINT #1:"21"
PRINT #1:Y3
PRINT #1:"31"
PRINT #1:Z3
PRINT #1:"12"
PRINT #1:X7
PRINT #1:"22"
PRINT #1:Y7
PRINT #1:"32"
PRINT #1:Z7
PRINT #1:"13"
PRINT #1:X6
PRINT #1:"23"
PRINT #1:Y6
PRINT #1:"33"
PRINT #1:Z6
|
|