Observe the bottom of the plot

Engineering & Scientific library: http://zinnamturm.eu/downloadsIN.htm#Lib

Observe the bottom of the plot

Postby Ivan Denisov » 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.
Attachments
demo3d.png
User avatar
Ivan Denisov
 
Posts: 238
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Observe the bottom of the plot

Postby Robert » Wed Oct 07, 2015 8:35 am

Ivan Denisov wrote:I had problem with 3D plots, if I saw drawing from the bottom side. Is there any solution for fixing this?

Not sure!

Have you tried changing "hdr.hideOn := TRUE" to FALSE? Does that do what you need?
User avatar
Robert
 
Posts: 113
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Observe the bottom of the plot

Postby Ivan Denisov » Wed Oct 07, 2015 10:02 am

Thank you, Robert! It works now!

To make my drawing I took the code from LibDemoPlots.Demo3D and this flag is set FALSE there. The answer seems obvious now :)
User avatar
Ivan Denisov
 
Posts: 238
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia


Return to Lib

Who is online

Users browsing this forum: No registered users and 1 guest

cron