MathGL 2.0.beta该版本有很多的变化,包括新的结构,接口,新的平面图等等。
MathGL是一个">在Windows和Linux下生成高质量图形的类库;用来根据大量的数组生成各种图表;可轻松嵌入到其他程序中;可生成各种各样的图表。
下载地址:http://sourceforge.net/projects/mathgl/files/mathgl/mathgl%202.beta/mathgl-2x.tgz/download
使用示例:
C++ code
mglData a(50,40);
a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))");
gr->Rotate(40,60);
gr->Box(); gr->Light(true); gr->Fog(1,0.1);
gr->Surf(a); gr->C++ont(a,"y");
MGL code
new a 50 40
modify a '0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))'
rotate 40 60
box: fog 1 0.1: light on
surf a: cont a 'y'
Pure C code
HMDT a = mgl_create_data_size(50,40,1);
mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0);
mgl_rotate(gr,40.,60.,0.);
mgl_box(gr,1);
mgl_fog(gr,1.,0.1)
mgl_light(gr,1)
mgl_surf(gr,a,0);
mgl_cont(gr,a,"y",7,NAN);
mgl_delete_data(a);
Fortran code
integer a, mgl_create_data_size
real zero, nan
! I don't know the NaN symbol in Fortran. So I produce it as zero/zero
zero = 0; nan = zero/zero
a = mgl_create_data_size(50,40,1);
call mgl_data_modify(a,"0.6*sin(2*pi*x)*sin(3*pi*y) + 0.4*cos(3*pi*(x*y))",0);
call mgl_rotate(gr,40.,60.,0.)
call mgl_box(gr,1)
call mgl_fog(gr,1.,0.1)
call mgl_light(gr,1)
call mgl_surf(gr,a,'')
call mgl_cont(gr,a,'y',7,nan)
call mgl_delete_data(a)
Python
a = mglData(50,40);
a.Modify("0.6*sin(2*pi*x)*sin(3*pi*y)+0.4*cos(3*pi*(x*y))");
gr.Rotate(40,60);
gr.Box(); gr.Light(1); gr.Fog(1,0.1);
gr.Surf(a); gr.Cont(a,"y");