File: surfl.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 (62 lines) | stat: -rw-r--r-- 1,833 bytes parent folder | download | duplicates (4)
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
## Copyright (C) 2001-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, 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.

## usage: surfl ([x, y,] z [, s])
##
## Shaded Surface plot with lighting.
##
## If x, y, and z are matrices with the same dimensions,
##    then corresponding elements represent vertices of the plot.
##
## If x and y are vectors, then a typical vertex is (x(j), y(i), z(i,j)).  Thus,
##    columns of z correspond to different x values and rows of z correspond
##    to different y values.
##
## `s', if existent, set the light source in cartesian coordinates [Sx Sy Sz]
##    or [Saz Sel] in spherical coordinates; in this case, the light source will
##    be at a distance 10 from the origin.
##    Ilumination can also be set by pllightsource(Sx, Sy, Sz)

function surfl (x, y, z, s)

  global __pl

  flag = 0;
  if (nargin == 2)
    s = y; flag = 1;
  elseif (nargin == 1 || nargin == 3)
    s = [10, 10, 10];
  elseif (nargin == 4)
    flag = 1;
  endif

  if (isvector(s))
    if (length(s) == 2) ## [az, alt]
      s = [10*cos(s(1)); 10*sin(s(1)); 10*sin(s(2))];
    endif
  else
    error("surfl: s must be a vector\n");
  endif

  __pl.light = s;

  if (nargin == 1  || (nargin == 2 && flag))
    __pl_mesh ("surfl", x);
  elseif (nargin == 3 || (nargin == 4 && flag))
    __pl_mesh ("surfl", x, y, z);
  else
    help "surfl"
  endif

endfunction