[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
9.4.4 Map sample
C++ code
mglData a(50, 40), b(50, 40); gr->Puts(mglPoint(0, 0), "\\to", "", -1.4); gr->Axis(mglPoint(-1,-1,-2),mglPoint(1,1,2)); gr->SubPlot(2, 1, 0); a.Fill("x", gr->Min, gr->Max); b.Fill("y", gr->Min, gr->Max); gr->Puts(mglPoint(0, 1.1), "\\{x, y\\}", "C", -2); gr->Box(); gr->Map(a, b, "brgk", 0, false); gr->SubPlot(2, 1, 1); a.Fill("(x^3+y^3)/2", gr->Min, gr->Max); b.Fill("(x-y)/2", gr->Min, gr->Max); gr->Puts(mglPoint(0, 1.1), "\\{\\frac{x^3+y^3}{2}, \\frac{x-y}{2}\\}", "C", -2); gr->Box(); gr->Map(a, b, "brgk", 0, false);
MGL code
new a 50 40 new b 50 40 text 0 0 '\to' zrange -2 2 subplot 2 1 0 text 0 1.1 '\{x, y\}' '' -2 box fill a 'x' fill b 'y' map a b 'brgk' 0 0 subplot 2 1 1 text 0 1.1 '\{\frac{x^3+y^3}{2}, \frac{x-y}{2}\}' '' -2 box fill a '(x^3+y^3)/2' fill b '(x-y)/2' map a b 'brgk' 0 0
Pure C code
HMDT a = mgl_create_data_size(50,40,1); HMDT b = mgl_create_data_size(50,40,1); mgl_puts_ext(gr, 0.,0.,0., "\\to", "", -1.4, 't'); mgl_set_axis_3d(gr,-1.,-1.,-2.,1.,1.,2.); mgl_subplot(gr, 2, 1, 0); mgl_data_fill_eq(gr, a, "x", 0, 0); mgl_data_fill_eq(gr, b, "y", 0, 0); mgl_puts_ext(gr, 0.,1.1,0., "\\{x, y\\}", "C", -2., 't'); mgl_box(gr,1); mgl_map(gr, a, b, "brgk", 0, 0); mgl_subplot(gr, 2, 1, 1); mgl_data_fill_eq(gr, a, "(x^3+y^3)/2", 0, 0); mgl_data_fill_eq(gr, b, "(x-y)/2", 0, 0); mgl_puts_ext(gr, 0.,1.1,0., "\\{\\frac{x^3+y^3}{2}, \\frac{x-y}{2}\\}", "C", -2., 't'); mgl_box(gr,1); mgl_map(gr, a, b, "brgk", 0, 0); mgl_box(gr,1); mgl_map(gr,a,b,0,0,1); mgl_delete_data(a); mgl_delete_data(b);
Fortran code
integer a,b, mgl_create_data_size a = mgl_create_data_size(50,40,1); b = mgl_create_data_size(50,40,1); call mgl_puts_ext(gr, 0.,0.,0., '\to', '', -1.4, 't'); call mgl_set_axis_3d(gr,-1.,-1.,-2.,1.,1.,2.); call mgl_subplot(gr, 2, 1, 0); call mgl_data_fill_eq(gr, a, 'x', 0, 0); call mgl_data_fill_eq(gr, b, 'y', 0, 0); call mgl_puts_ext(gr, 0.,1.1,0., '\{x, y\}', 'C', -2., 't'); call mgl_box(gr,1); call mgl_map(gr, a, b, 'brgk', 0, 0); call mgl_subplot(gr, 2, 1, 1); call mgl_data_fill_eq(gr, a, '(x^3+y^3)/2', 0, 0); call mgl_data_fill_eq(gr, b, '(x-y)/2', 0, 0); call mgl_puts_ext(gr, 0.,1.1,0., '\{\frac{x^3+y^3}{2}, \frac{x-y}{2}\}', 'C', -2., 't'); call mgl_box(gr,1); call mgl_map(gr, a, b, 'brgk', 0, 0); call mgl_box(gr,1); call mgl_map(gr,a,b,0,0,1); call mgl_delete_data(a) call mgl_delete_data(b)
Python
a, b = mglData(50,40), mglData(50,40); gr.Puts(0, 0, 0, "\\to", "", -1.4); gr.SetRanges(-1,1,-1,1,-2,2); gr.SubPlot(2, 1, 0); gr.Fill(a, "x"); gr.Fill(b, "y"); gr.Puts(0, 1.1, 0, "\\{x, y\\}", "C", -2); gr.Box(); gr.Map(a, b, "brgk", 0, 0); gr.SubPlot(2, 1, 1); gr.Fill(a, "(x^3+y^3)/2"); gr.Fill(b, "(x-y)/2"); gr.Puts(0, 1.1, 0, "\\{\\frac{x^3+y^3}{2}, \\frac{x-y}{2}\\}", "C", -2); gr.Box(); gr.Map(a, b, "brgk", 0, 0);
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |