Observe the bottom of the plot
Posted: Wed Oct 07, 2015 4:21 am
I had problem with 3D plots, if I saw drawing from the bottom side. Is there any solution for fixing this?
Code: Select all
MODULE DemoPlot3d;
IMPORT Plotters := LibPlotters, Plot3D := LibPlot3D, Mat := LibMatrices,
R := LibReals, Plot3DBase := LibPlot3DBase, M := Math, LibPlotHook, Ports;
CONST
ixMax = 30;
jyMax = 30;
TYPE
SpinTool = POINTER TO RECORD (Plot3DBase.SpinTool) END;
PROCEDURE Demo3D*;
VAR
tool: SpinTool;
zDat: Mat.Matrix;
hdr: Plot3DBase.Hdr3D;
p: Plot3DBase.Plotter;
PROCEDURE MakePeaks (ixMax, jyMax: INTEGER): Mat.Matrix;
VAR
zDat: Mat.Matrix;
ix, jy: INTEGER;
xMid, yMid, x, y: REAL;
PROCEDURE Peaks (x, y: REAL): REAL;
VAR
z1, z2, z3: REAL;
BEGIN
z1 := 3. * R.Sqr(1. - x) * M.Exp( - x * x - R.Sqr(1. + y));
z2 := - 10 * (x / 5. - x * x * x - M.IntPower(y, 5)) * M.Exp( - x * x - y * y);
z3 := - M.Exp( - R.Sqr(1. + x) - y * y) / 3.;
RETURN (5. + z1 + z2 + z3) / 15.
END Peaks;
BEGIN
xMid := ixMax / 2.;
yMid := jyMax / 2.;
zDat := Mat.SetRC(ixMax + 1, jyMax + 1, 0.);
FOR ix := 0 TO ixMax DO
x := 6. * (ix - xMid) / ixMax;
FOR jy := 0 TO jyMax DO
y := 6. * (jy - yMid) / jyMax;
zDat[ix, jy] := Peaks(x, y)
END
END;
RETURN zDat
END MakePeaks;
BEGIN
zDat := MakePeaks(ixMax, jyMax);
p := Plot3DBase.NewPlotter(Plot3D.dir, 'Wire frame demo', Plotters.dir.OldPalette(3));
hdr := p.hdr;
hdr.faceCol := Ports.black;
hdr.edgeCol := Ports.black;
hdr.eyeAz := 228;
hdr.eyeEl := 30;
hdr.doFace := TRUE; hdr.persp := TRUE;
hdr.doEdge := TRUE; hdr.doTilt := TRUE;
hdr.hideOn := TRUE; hdr.eyeD := 100.;
NEW(tool);
p.DrawMap3D(Plot3D.dir, zDat, tool);
Plotters.OpenAux(p, 120, 90, TRUE, '');
END Demo3D;
BEGIN
LibPlotHook.Attach
END DemoPlot3d.