File: __pl_meshplotit.m

package info (click to toggle)
plplot 5.10.0%2Bdfsg2-0.4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 25,792 kB
  • ctags: 13,517
  • sloc: ansic: 83,001; xml: 27,081; ada: 18,878; cpp: 15,966; tcl: 11,651; python: 7,075; f90: 7,058; ml: 6,974; java: 6,665; perl: 5,029; sh: 2,208; makefile: 210; lisp: 75; sed: 25; fortran: 7
file content (117 lines) | stat: -rw-r--r-- 3,274 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
## Copyright (C) 2003 Joao Cardoso.
## 
## This program is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 2 of the License, or (at your
## option) any later version.
## 
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
## General Public License for more details.
##
## This file is part of plplot_octave.

function __pl_meshplotit()

  global __pl
  global DRAW_LINEXY MAG_COLOR BASE_CONT
  global TOP_CONT SURF_CONT DRAW_SIDES FACETED MESH

  strm = __pl_init;

  xm = __pl.lxm(strm); xM = __pl.lxM(strm); 
  ym = __pl.lym(strm); yM = __pl.lyM(strm); 
  zm = __pl.lzm(strm); zM = __pl.lzM(strm);

  if (xm == xM)
    xM = xm +10*eps;
  endif
  if (ym == yM)
    yM = ym +10*eps;
  endif
  if (zm == zM)
    zM = zm +10*eps;
  endif

  if (__pl.axis_st(strm))
    xm = __pl.axis(strm,1); xM = __pl.axis(strm,2);	# at least x always exist

    if (length(__pl.axis) >= 4)	
      ym = __pl.axis(strm,3); yM = __pl.axis(strm,4);
    else
      __pl.axis(strm,3) = ym; __pl.axis(strm,4) = yM;
    endif
    if (length(__pl.axis) == 6)
      zm = __pl.axis(strm,5); zM = __pl.axis(strm,6);
    else
      __pl.axis(strm,5) = zm; __pl.axis(strm,6) = zM;		
    endif
  else	# make axis() return current axis
    __pl.axis(strm,1) = xm; __pl.axis(strm,2) = xM;
    __pl.axis(strm,3) = ym; __pl.axis(strm,4) = yM;
    __pl.axis(strm,5) = zm; __pl.axis(strm,6) = zM;		
  endif
  
  plcol0(15);pllsty(1);
  if (__pl.multi(strm) == 1)	# multiplot, erase current subwindow
    plclear;
  else
    pladv(0);
  endif

  plvpor(0, 1, 0, 0.95);
  plwind(-1.6, 1.6, -1.3, 2.2);
  plw3d(2, 2, 2, xm, xM, ym, yM, zm, zM, __pl.alt(strm), __pl.az(strm))
  plbox3("bnstu", tdeblank(__pl.xlabel(strm,:)), 0.0, 0,
	 "bnstu", tdeblank(__pl.ylabel(strm,:)), 0.0, 0,
	 "bcmnstuv", tdeblank(__pl.zlabel(strm,:)), 0.0, 0);
  plcol0(1);

  nlev = 10;
  st = (zM-zm)/nlev/2;
  clevel = (linspace(zm+st, zM-st, nlev))';
  levs = 0;

  shad = tdeblank(__pl.shading(strm,:));
  switch (shad)
    case "flat"
      sh = 0;
    case "faceted"
      sh = FACETED;
    case "contour"
      sh = SURF_CONT;
      levs = clevel;
  endswitch

  for items=1:__pl.items(strm)-1
    x = __pl.x{items, strm};
    y = __pl.y{items, strm};
    z = __pl.z{items, strm};

    ## kludge, use "fmt" as plot type. But __pl_plotit still uses __pl.type
    type = __pl.fmt{items, strm};

  switch (type)
    case 100  ## mesh
      plmesh(x, y, z', DRAW_LINEXY + MAG_COLOR);
    case 101  ## meshc
      plmeshc(x, y, z', DRAW_LINEXY + MAG_COLOR + BASE_CONT, clevel);
    case 102  ## meshz
      plot3d(x, y, z', DRAW_LINEXY + MAG_COLOR, 1); 
    case 103  ## surf
      plsurf3d(x, y, z', MAG_COLOR + sh, clevel);
    case 104   ## surfc
      plsurf3d(x, y, z', MAG_COLOR + BASE_CONT + sh, clevel) 
    case 105   ## surfl
      pllightsource(__pl.light(1), __pl.light(2), __pl.light(3));
      plsurf3d(x, y, z', sh, levs);
  endswitch	

  endfor
  
  plcol0(15);
  plmtex("t", 1, 0.5,0.5, tdeblank(__pl.tlabel(strm,:)));
  plflush;

endfunction