⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fdeeul3.prg

📁 defequ
💻 PRG
字号:
Execute(GetConfig(1));
autogr3config(x___):={if(AskUserYesNo("There is an error in your 3D graphics view configuration:"+chr(13)+x___+chr(13)+"Do you want to configure the 3D graphics view automatically?")==0,{abort(x___);},
{
axe1:=chr(34)+GetUserInput("Enter the expression displayed on the first axis:")+chr(34);
axe2:=chr(34)+GetUserInput("Enter the expression displayed on the second axis:")+chr(34);
axe3:=chr(34)+GetUserInput("Enter the expression displayed on the third axis:")+chr(34);
computeall:=GetUserInput("Enter the coordinates (separated by ,) of the view direction:");
vdir[0]:=atof(computeall);
if((i:=findchar(computeall,","))==-1,{Abort("You must enter three coordinates separated by ','");},{});
computeall:=strmid(computeall,i+1,99);
vdir[1]:=atof(computeall);
if((i:=findchar(computeall,","))==-1,{Abort("You must enter three coordinates separated by ','");},{});
computeall:=strmid(computeall,i+1,99);
vdir[2]:=atof(computeall);
computeall:=GetUserInput("Enter the coordinates (separated by ,) of the view point:");
vpt[0]:=atof(computeall);
if((i:=findchar(computeall,","))==-1,{Abort("You must enter three coordinates separated by ','");},{});
computeall:=strmid(computeall,i+1,99);
vpt[1]:=atof(computeall);
if((i:=findchar(computeall,","))==-1,{Abort("You must enter three coordinates separated by ','");},{});
computeall:=strmid(computeall,i+1,99);
vpt[2]:=atof(computeall);
ext:=atof(GetUserInput("Enter the +/- extents of the axes from the view point:"));
SetConfig(computeall:="axe1:="+axe1+";"+chr(13)+chr(10)+
"axe2:="+axe2+";"+chr(13)+chr(10)+
"axe3:="+axe3+";"+chr(13)+chr(10)+
"vdir[0]:="+numtos(vdir[0])+";"+
"vdir[1]:="+numtos(vdir[1])+";"+
"vdir[2]:="+numtos(vdir[2])+";"+chr(13)+chr(10)+
"vpt[0]:="+numtos(vpt[0])+";"+
"vpt[1]:="+numtos(vpt[1])+";"+
"vpt[2]:="+numtos(vpt[2])+";"+chr(13)+chr(10)+
"ext:="+numtos(ext)+";"+chr(13)+chr(10));
Abort("The setup is complete."+chr(13)+"Use File/Execute to start again."+chr(13)+chr(13)+computeall);
});
};
if(valid(draw)!=-1,{draw:=7;},{});
if(valid(axe1)!=-4,{autogr3config("You must define the variable axe1 as the text containing the expression to be displayed on the first axis.");},{});
if(valid(axe2)!=-4,{autogr3config("You must define the variable axe2 as the text containing the expression to be displayed on the second axis.");},{});
if(valid(axe3)!=-4,{autogr3config("You must define the variable axe3 as the text containing the expression to be displayed on the third axis.");},{});
if(((valid(vdir[0])!=-1)&&(valid(vdir[0])!=-2))||((valid(vdir[1])!=-1)&&(valid(vdir[1])!=-2))||((valid(vdir[2])!=-1)&&(valid(vdir[2])!=-2)),
{autogr3config("You must define the vector variable vdir[] as the view direction vector.");},{});
if(((valid(vpt[0])!=-1)&&(valid(vpt[0])!=-2))||((valid(vpt[1])!=-1)&&(valid(vpt[1])!=-2))||((valid(vpt[2])!=-1)&&(valid(vpt[2])!=-2)),
{autogr3config("You must define the vector variable vpt[] as the view point.");},{});
if((valid(ext)!=-1)&&(valid(ext)!=-2),{autogr2config("You must define the variable ext as the +/- extents of the axes from the view point.");},{});
rdir[0]:=vdir[1];rdir[1]:=-vdir[0];rdir[2]:=0.0;
udir[0]:=-vdir[0]*vdir[2];udir[1]:=-vdir[1]*vdir[2];
g_u:=pow((udir[2]:=vdir[0]*vdir[0]+vdir[1]*vdir[1])+vdir[2]*vdir[2],0.5);
vdir[0]:=vdir[0]/g_u;vdir[1]:=vdir[1]/g_u;vdir[2]:=vdir[2]/g_u;
g_u:=pow(rdir[0]*rdir[0]+rdir[1]*rdir[1],0.5);
rdir[0]:=rdir[0]/g_u;rdir[1]:=rdir[1]/g_u;
g_u:=pow(udir[0]*udir[0]+udir[1]*udir[1]+udir[2]*udir[2],0.5);
udir[0]:=udir[0]/g_u;udir[1]:=udir[1]/g_u;udir[2]:=udir[2]/g_u;
moveto3d(g_x,g_y,g_z):={moveto((g_x-vpt[0])*rdir[0]+(g_y-vpt[1])*rdir[1]+(g_z-vpt[2])*rdir[2],(g_x-vpt[0])*udir[0]+(g_y-vpt[1])*udir[1]+(g_z-vpt[2])*udir[2]);};
lineto3d(g_x,g_y,g_z):={lineto((g_x-vpt[0])*rdir[0]+(g_y-vpt[1])*rdir[1]+(g_z-vpt[2])*rdir[2],(g_x-vpt[0])*udir[0]+(g_y-vpt[1])*udir[1]+(g_z-vpt[2])*udir[2]);};
min1:=-ext*(abs(rdir[0])+abs(rdir[1])+abs(rdir[2]));
max1:=ext*(abs(rdir[0])+abs(rdir[1])+abs(rdir[2]));
min2:=-ext*(abs(udir[0])+abs(udir[1])+abs(udir[2]));
max2:=ext*(abs(udir[0])+abs(udir[1])+abs(udir[2]));
ChangeFont("Courier New",g_fs:=12,0);
g_ext:=7200.0/g_fs;
g_sx:=(max1-min1)/g_ext;
g_sy:=(max2-min2)/g_ext;
if(draw&&4,{g_s:=max(g_sx,g_sy);
WindowExt(min1,min2+g_s*g_ext,min1+g_s*g_ext,min2);},
{WindowExt(min1,max2,max1,min2);});
if(draw&&1,{
UPDFrequency(16);
moveto3d(vpt[0]-ext,0,0);lineto3d(vpt[0]+ext,0,0);
moveto3d(0,vpt[1]-ext,0);lineto3d(0,vpt[1]+ext,0);
moveto3d(0,0,vpt[2]-ext);lineto3d(0,0,vpt[2]+ext);
moveto3d(vpt[0]+ext*0.95,ext*0.05,0);printf("%s",axe1);
moveto3d(ext*0.05,vpt[1]+ext*0.95,0);printf("%s",axe2);
moveto3d(ext*0.05,ext*0.05,vpt[2]+ext*0.9);printf("%s",axe3);
UPDFrequency(6);
DisplayView(0);
},{});
tozero:=execute("{MoveTo3d("+axe1+","+axe2+","+axe3+");}");
if(draw&&2,{
execute(tozero);
OnUpdate(execute("{LineTo3d("+axe1+","+axe2+","+axe3+");}"));
},{});
g_printing:=execute("{PenSize(5);
g_min1:=min1;g_max1:=max1;g_min2:=min2;g_max2:=max2;
g_s:=(max1-min1)/2;min1:=min1-g_s;max1:=max1+g_s;
g_s:=(max2-min2)/2;min2:=min2-g_s;max2:=max2+g_s;
g_sx:=(max1-min1)/(getwinsize(2)-getwinsize(0));
g_sy:=(max2-min2)/(getwinsize(3)-getwinsize(1));
if(draw&&4,{g_s:=max(g_sx,g_sy);
WindowExt(min1,min2+g_s*(getwinsize(3)-getwinsize(1)),min1+g_s*(getwinsize(2)-getwinsize(0)),min2);},
{g_s:=min((getwinsize(2)-getwinsize(0))/4,(getwinsize(3)-getwinsize(1))/3);
g_x:=(max1-min1)*((getwinsize(2)-getwinsize(0))/4/g_s-1.0)/2.0;
g_y:=(max2-min2)*((getwinsize(3)-getwinsize(1))/3/g_s-1.0)/2.0;
WindowExt(min1-g_x,max2+g_y,max1+g_x,min2-g_y);});
min1:=g_min1;max1:=g_max1;min2:=g_min2;max2:=g_max2;
execute(g_drawaxes);
t:=t0;MoveTo3d("+axe1+","+axe2+","+axe3+");
while({t<=maxt},{LineTo3d("+axe1+","+axe2+","+axe3+");t:=t+dt;});
}");
OnPrinting(g_printing);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -