Mercurial > octave
annotate scripts/plot/draw/light.m @ 22247:c8fc60a183a3
Add function material. (patch #9013)
* scripts/plot/appearance/material.m: New function.
* scripts/plot/appearance/module.mk: Update build system.
* NEWS: Announce new function.
* __unimplemented__.m: Remove "material" from list.
* doc/interpreter/plot.txi: Add doc string.
* light.m: Add "material" to "see also".
author | Markus Muetzel <markus.muetzel@gmx.de> |
---|---|
date | Mon, 18 Jul 2016 17:46:05 +0200 |
parents | 20b225a3ebf8 |
children | 9fc91bb2aec3 |
rev | line source |
---|---|
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
1 ## Copyright (C) 2016 Markus Muetzel |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
2 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
4 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
8 ## your option) any later version. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
9 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
13 ## General Public License for more details. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
14 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
18 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
20 ## @deftypefn {} {} light () |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
21 ## @deftypefnx {} {} light (@dots{}, @var{prop}, @var{val}, @dots{}) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
22 ## @deftypefnx {} {} light (@var{hax}, @dots{}) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
23 ## @deftypefnx {} {@var{h} =} light (@dots{}) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
24 ## Create light object in the current axes or for axes @var{hax}. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
25 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
26 ## When a light object is present in an axes object and the properties |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
27 ## @qcode{"EdgeLighting"} or @qcode{"FaceLighting"} of a @command{patch} or |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
28 ## @command{surface} object are set to a value other than @qcode{"none"}, these |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
29 ## objects are drawn with light and shadow effects. Supported values for these |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
30 ## properties are @qcode{"none"} (no lighting effects), @qcode{"flat"} |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
31 ## (facetted look of the objects) and @qcode{"gouraud"} (linear interpolation |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
32 ## of the lighting effects between the vertices). |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
33 ## For @command{patch} objects, the normals must be set manually (property |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
34 ## @qcode{"VertexNormals"}). |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
35 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
36 ## Up to eight light objects are supported per axes. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
37 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
38 ## Lighting is only supported for graphics toolkits supporting OpenGL (i.e. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
39 ## @qcode{"fltk"} and @qcode{"qt"}). |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
40 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
41 ## The following properties specific to the light object can be passed with |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
42 ## their respective values: |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
43 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
44 ## @table @asis |
21937
55f7de37b618
maint: Strip trailing whitespace from source files.
John W. Eaton <jwe@octave.org>
parents:
21789
diff
changeset
|
45 ## @item @qcode{"Color":} The color of the light object can be passed as an |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
46 ## RGB-vector (e.g. @qcode{[1 0 0]} for red) or as a string (e.g. @qcode{"r"} |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
47 ## for red). The default color is white (@qcode{[1 1 1]}). |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
48 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
49 ## @item @qcode{"Position":} The direction from which the light emanates as an |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
50 ## 1x3-vector. The default direction is @qcode{[1 0 1]}. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
51 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
52 ## @item @qcode{"Style":} This string defines whether the light emanates from a |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
53 ## light source at infinite distance (@qcode{"infinite"}) or from a local point |
22192
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
54 ## source (@qcode{"local"}). |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
55 ## @end table |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
56 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
57 ## If @command{light} is called with an axes handle @var{hax}, it must be passed |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
58 ## as the first argument. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
59 ## |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
60 ## Optionally, the handle to the light object is returned in @var{h}. |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
61 ## |
22247
c8fc60a183a3
Add function material. (patch #9013)
Markus Muetzel <markus.muetzel@gmx.de>
parents:
22192
diff
changeset
|
62 ## @seealso{get, set, patch, surface, lighting, material} |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
63 ## @end deftypefn |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
64 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
65 ## Author: mmuetzel |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
66 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
67 function h = light (varargin) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
68 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
69 [hax, varargin] = __plt_get_axis_arg__ ("light", varargin{:}); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
70 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
71 if (isempty (hax)) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
72 hax = gca (); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
73 else |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
74 hax = hax(1); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
75 endif |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
76 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
77 htmp = __go_light__ (hax, varargin{:}); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
78 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
79 if (nargout > 0) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
80 h = htmp; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
81 endif |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
82 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
83 endfunction |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
84 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
85 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
86 %!demo |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
87 %! %% Demonstrate effects of lighting |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
88 %! clf; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
89 %! %% patches |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
90 %! h_axes1 = subplot (2, 2, 1); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
91 %! [x,y,z] = meshgrid (-2:0.2:2, -2:0.2:2, -2:0.2:2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
92 %! val = x.^2 + y.^2 + z.^2; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
93 %! fv1 = isosurface (x, y, z, val, 1); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
94 %! h_patch1 = patch (fv1, "FaceColor", "c", "EdgeColor", "none", ... |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
95 %! "FaceLighting", "Gouraud"); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
96 %! isonormals (x, y, z, val, h_patch1); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
97 %! fv2 = isosurface (x, y+3, z, val, 1); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
98 %! h_patch2 = patch (fv2, "FaceColor", "r", "EdgeColor", "none", ... |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
99 %! "FaceLighting", "Gouraud"); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
100 %! isonormals (x, y+3, z, val, h_patch2); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
101 %! axis equal; axis tight |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
102 %! title ("Patch with lighting"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
103 %! view (3); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
104 %! h_light1 = light (); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
105 %! |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
106 %! h_axes2 = subplot (2, 2, 2); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
107 %! patch (fv1, "FaceColor", "c", "EdgeColor", "none"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
108 %! patch (fv2, "FaceColor", "r", "EdgeColor", "none"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
109 %! axis equal; axis tight |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
110 %! title ("Patch without lighting"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
111 %! view (3); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
112 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
113 %! %% surfaces |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
114 %! h_axes3 = subplot (2, 2, 3); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
115 %! h_surf1 = surf (h_axes3, peaks, "LineStyle", "none", ... |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
116 %! "FaceLighting", "Gouraud"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
117 %! title ("Surface with lighting"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
118 %! view (3); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
119 %! h_light2 = light (); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
120 %! |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
121 %! h_axes3 = subplot (2, 2, 4); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
122 %! h_surf2 = surf (h_axes3, peaks, "LineStyle", "none"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
123 %! title ("Surface without lighting"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
124 %! view (3); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
125 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
126 %!demo |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
127 %! %% Lighting modes |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
128 %! clf; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
129 %! [x,y,z] = meshgrid (-.2:0.05:.2, -.2:0.05:.2, -.2:0.05:.2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
130 %! val = (x.^2 + y.^2 + z.^2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
131 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
132 %! h_axes1 = axes (); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
133 %! fv = isosurface (x, y, z, val, .039); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
134 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", ... |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
135 %! "FaceLighting", "none"); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
136 %! isonormals (x, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
137 %! fv = isosurface (x+.5, y, z, val, .039); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
138 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", ... |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
139 %! "FaceLighting", "flat"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
140 %! isonormals (x+.5, y, z, val, h_patch) |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
141 %! fv = isosurface (x+1, y, z, val, .039); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
142 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", ... |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
143 %! "FaceLighting", "Gouraud"); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
144 %! isonormals (x+1, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
145 %! axis tight |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
146 %! axis equal |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
147 %! view (2); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
148 %! light ("Position", [-1 1 1]); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
149 %! title ("FaceLighting: none - flat - gouraud"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
150 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
151 %!demo |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
152 %! %% multiple lights |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
153 %! clf; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
154 %! h_axes = subplot (1, 2, 1); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
155 %! [x,y,z] = meshgrid (-2:0.1:2, -2:0.1:2, -2:0.1:2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
156 %! val = x.^2 + y.^2 + z.^2; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
157 %! fv = isosurface (x, y, z, val, 1); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
158 %! h_patch = patch (fv, "FaceColor", "w", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
159 %! isonormals (x, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
160 %! axis equal; axis tight |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
161 %! title ("Patch with one light"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
162 %! view (3); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
163 %! h_light = light ("Color", "g"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
164 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
165 %! h_axes2 = subplot (1, 2, 2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
166 %! h_patch2 = patch (fv, "FaceColor", "w", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
167 %! isonormals (x, y, z, val, h_patch2); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
168 %! axis equal; axis tight |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
169 %! title ("Patch with three lights"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
170 %! view (3); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
171 %! h_light1 = light ("Color", "r"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
172 %! h_light2 = light ("Position", [0 1 1], "Color", "b"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
173 %! h_light3 = light ("Position", [-1 -1 2], "Color", "g"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
174 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
175 %!demo |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
176 %! %% Diffuse and specular reflex |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
177 %! clf; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
178 %! h_axes = axes (); |
22192
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
179 %! [x,y,z] = meshgrid (-.2:0.04:.2, -.2:0.04:.2, -.2:0.04:.2); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
180 %! val = (x.^2 + y.^2 + z.^2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
181 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
182 %! fv = isosurface (x, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
183 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
184 %! set (h_patch, "DiffuseStrength", 0, "SpecularStrength", 0); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
185 %! isonormals (x, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
186 %! fv = isosurface (x+.5, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
187 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
188 %! set (h_patch, "DiffuseStrength", 0, "SpecularStrength", .5); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
189 %! isonormals (x+.5, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
190 %! fv = isosurface (x+1, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
191 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
192 %! set (h_patch, "DiffuseStrength", 0, "SpecularStrength", 1); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
193 %! isonormals (x+1, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
194 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
195 %! fv = isosurface (x, y+.5, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
196 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
197 %! set (h_patch, "DiffuseStrength", 0.5, "SpecularStrength", 0); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
198 %! isonormals (x, y+.5, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
199 %! fv = isosurface (x+.5, y+.5, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
200 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
201 %! set (h_patch, "DiffuseStrength", 0.5, "SpecularStrength", .5); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
202 %! isonormals (x+.5, y+.5, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
203 %! fv = isosurface (x+1, y+.5, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
204 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
205 %! set (h_patch, "DiffuseStrength", 0.5, "SpecularStrength", 1); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
206 %! isonormals (x+1, y+.5, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
207 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
208 %! fv = isosurface (x, y+1, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
209 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
210 %! set (h_patch, "DiffuseStrength", 1, "SpecularStrength", 0); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
211 %! isonormals (x, y+1, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
212 %! fv = isosurface (x+.5, y+1, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
213 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
214 %! set (h_patch, "DiffuseStrength", 1, "SpecularStrength", .5); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
215 %! isonormals (x+.5, y+1, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
216 %! fv = isosurface (x+1, y+1, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
217 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
218 %! set (h_patch, "DiffuseStrength", 1, "SpecularStrength", 1); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
219 %! isonormals (x+1, y+1, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
220 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
221 %! axis equal |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
222 %! h_light = light ("Position", [-1 1 1]); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
223 %! view (2); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
224 %! |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
225 %! xlabel ("SpecularStrength"); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
226 %! ylabel ("DiffuseStrength"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
227 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
228 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
229 %!demo |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
230 %! %% Ambient Strength and Ambient Light Color |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
231 %! clf; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
232 %! [x,y,z] = meshgrid (-.2:0.05:.2, -.2:0.05:.2, -.2:0.05:.2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
233 %! val = (x.^2 + y.^2 + z.^2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
234 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
235 %! h_axes1 = subplot (3,1,3); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
236 %! set (h_axes1, "AmbientLightColor", "g"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
237 %! fv = isosurface (x, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
238 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
239 %! set (h_patch, "AmbientStrength", 0); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
240 %! isonormals (x, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
241 %! fv = isosurface (x+.5, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
242 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
243 %! set (h_patch, "AmbientStrength", .7); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
244 %! isonormals (x+.5, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
245 %! fv = isosurface (x+1, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
246 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
247 %! set (h_patch, "AmbientStrength", 1); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
248 %! isonormals (x+1, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
249 %! h_light = light ("Position", [-1 1 1]); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
250 %! axis tight |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
251 %! axis equal |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
252 %! view (2); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
253 %! xlabel ("AmbientStrength"); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
254 %! ylabel ("AmbientLightColor [0 1 0]"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
255 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
256 %! h_axes2 = subplot (3,1,2); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
257 %! set (h_axes2, "AmbientLightColor", [.5 0 1]); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
258 %! fv = isosurface (x, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
259 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
260 %! set (h_patch, "AmbientStrength", 0); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
261 %! isonormals (x, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
262 %! fv = isosurface (x+.5, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
263 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
264 %! set (h_patch, "AmbientStrength", .7); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
265 %! isonormals (x+.5, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
266 %! fv = isosurface (x+1, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
267 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
268 %! set (h_patch, "AmbientStrength", 1); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
269 %! isonormals (x+1, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
270 %! h_light = light ("Position", [-1 1 1]); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
271 %! axis tight |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
272 %! axis equal |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
273 %! view (2); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
274 %! ylabel ("AmbientLightColor [.5 0 1]"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
275 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
276 %! h_axes3 = subplot (3,1,1); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
277 %! set (h_axes3, "AmbientLightColor", "w"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
278 %! fv = isosurface (x, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
279 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
280 %! set (h_patch, "AmbientStrength", 0); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
281 %! isonormals (x, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
282 %! fv = isosurface (x+.5, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
283 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
284 %! set (h_patch, "AmbientStrength", .7); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
285 %! isonormals (x+.5, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
286 %! fv = isosurface (x+1, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
287 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
288 %! set (h_patch, "AmbientStrength", 1); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
289 %! isonormals (x+1, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
290 %! h_light = light ("Position", [-1 1 1]); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
291 %! axis tight |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
292 %! axis equal |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
293 %! view (2); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
294 %! ylabel ("AmbientLightColor [1 1 1]"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
295 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
296 %!demo |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
297 %! %% Specular Exponent |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
298 %! clf; |
22192
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
299 %! [x,y,z] = meshgrid (-.2:0.02:.2, -.2:0.02:.2, -.2:0.02:.2); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
300 %! val = (x.^2 + y.^2 + z.^2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
301 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
302 %! h_axes = axes (); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
303 %! fv = isosurface (x, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
304 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
305 %! set (h_patch, "SpecularExponent", 15); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
306 %! isonormals (x, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
307 %! fv = isosurface (x+.5, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
308 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
309 %! set (h_patch, "SpecularExponent", 5); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
310 %! isonormals (x+.5, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
311 %! fv = isosurface (x+1, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
312 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
313 %! set (h_patch, "SpecularExponent", 1); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
314 %! isonormals (x+1, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
315 %! h_light = light ("Position", [-1 1 1]); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
316 %! axis tight |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
317 %! axis equal |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
318 %! view (2); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
319 %! xlabel ("SpecularExponent"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
320 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
321 %!demo |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
322 %! %% SpecularColorReflectance |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
323 %! clf; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
324 %! [x,y,z] = meshgrid (-.2:0.02:.2, -.2:0.02:.2, -.2:0.02:.2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
325 %! val = (x.^2 + y.^2 + z.^2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
326 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
327 %! h_axes = axes (); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
328 %! fv = isosurface (x, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
329 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
330 %! set (h_patch, "SpecularColorReflectance", 0); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
331 %! isonormals (x, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
332 %! fv = isosurface (x+.5, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
333 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
334 %! set (h_patch, "SpecularColorReflectance", 0.5); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
335 %! isonormals (x+.5, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
336 %! fv = isosurface (x+1, y, z, val, .039); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
337 %! h_patch = patch (fv, "FaceColor", "r", "EdgeColor", "none", "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
338 %! set (h_patch, "SpecularColorReflectance", 1); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
339 %! isonormals (x+1, y, z, val, h_patch); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
340 %! h_light = light ("Position", [-1 1 1]); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
341 %! axis tight |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
342 %! axis equal |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
343 %! view (2); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
344 %! xlabel ("SpecularColorReflectance"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
345 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
346 %!demo |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
347 %! %% BackFaceLighting |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
348 %! [x,y,z] = meshgrid (-.5:0.1:2, -2:0.1:2, -2:0.1:2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
349 %! val = x.^2 + y.^2 + z.^2; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
350 %! fv = isosurface (x, y, z, val, 1); |
22149
ba8a9d2934c7
Point isonormals towards lower values for Matlab compatibility (bug #48552).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
22140
diff
changeset
|
351 %! vn = isonormals (x, y, z, val, fv.vertices, "negate"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
352 %! h_axes1 = subplot (1, 3, 1); |
22149
ba8a9d2934c7
Point isonormals towards lower values for Matlab compatibility (bug #48552).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
22140
diff
changeset
|
353 %! h_patch = patch (fv, "FaceColor", "c", "EdgeColor", "none", ... |
ba8a9d2934c7
Point isonormals towards lower values for Matlab compatibility (bug #48552).
Markus Muetzel <markus.muetzel@gmx.de>
parents:
22140
diff
changeset
|
354 %! "FaceLighting", "Gouraud", "VertexNormals", vn); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
355 %! set (h_patch, "BackFaceLighting", "reverselit"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
356 %! h_light = light (); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
357 %! view (h_axes1, [-50 30]); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
358 %! title ("reverselit"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
359 %! axis equal |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
360 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
361 %! h_axes2 = subplot (1, 3, 2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
362 %! h_patch = patch (fv, "FaceColor", "c", "EdgeColor", "none", ... |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
363 %! "FaceLighting", "Gouraud", "VertexNormals", vn); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
364 %! set (h_patch, "BackFaceLighting", "lit"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
365 %! h_light = light (); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
366 %! view (h_axes2, [-50 30]); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
367 %! title ("lit"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
368 %! axis equal |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
369 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
370 %! h_axes3 = subplot (1, 3, 3); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
371 %! h_patch = patch (fv, "FaceColor", "c", "EdgeColor", "none", ... |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
372 %! "FaceLighting", "Gouraud", "VertexNormals", vn); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
373 %! set (h_patch, "BackFaceLighting", "unlit"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
374 %! h_light = light (); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
375 %! view (h_axes3, [-50 30]); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
376 %! title ("unlit"); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
377 %! axis equal |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
378 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
379 %!demo |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
380 %! %% Colored patch |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
381 %! clf; |
22192
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
382 %! [x,y,z] = meshgrid (-.2:0.02:.2, -.2:0.02:.2, -.2:0.02:.2); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
383 %! val = (x.^2 + y.^2 + z.^2); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
384 %! |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
385 %! h_axes = axes (); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
386 %! fv = isosurface (x, y, z, val, .039, z); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
387 %! h_patch = patch (fv, "FaceColor", "flat", "EdgeColor", "none", ... |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
388 %! "FaceLighting", "Gouraud"); |
22151
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
389 %! set (h_patch, "SpecularExponent", 15); |
283d8dfcad37
Make demos Matlab compatible for comparison with dump_demos script.
Rik <rik@octave.org>
parents:
22149
diff
changeset
|
390 %! isonormals (x, y, z, val, h_patch); |
22192
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
391 %! title ('Colored patch'); |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
392 %! h_light = light ("Position", [-1 1 1]); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
393 %! axis tight |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
394 %! axis equal |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
395 %! view (3); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
396 |
22192
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
397 %!demo |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
398 %! %% Colored mesh (patch) |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
399 %! clf; |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
400 %! [x,y,z] = meshgrid (-.2:0.05:.2, -.2:0.05:.2, -.2:0.05:.2); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
401 %! val = (x.^2 + y.^2 + z.^2); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
402 %! |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
403 %! h_axes = axes (); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
404 %! fv = isosurface (x, y, z, val, .039, z); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
405 %! h_patch = patch (fv, 'FaceColor', 'w', 'EdgeColor', 'interp'); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
406 %! isonormals (x, y, z, val, h_patch); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
407 %! title ('Colored mesh (patch)'); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
408 %! h_light = light; |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
409 %! lighting gouraud |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
410 %! axis tight |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
411 %! axis equal |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
412 %! view (3); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
413 |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
414 %!demo |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
415 %! %% Colored mesh (surface) |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
416 %! clf; |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
417 %! h_mesh = mesh (peaks); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
418 %! title ('Colored mesh (surface)'); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
419 %! h_light = light; |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
420 %! lighting gouraud |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
421 |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
422 %!demo |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
423 %! %% Light in hggroup |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
424 %! clf; |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
425 %! h_mesh = mesh (peaks); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
426 %! h_hg = hggroup (); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
427 %! title ('Light in hggroup'); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
428 %! h_light = light ('Parent', h_hg); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
429 %! lighting gouraud |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
430 |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
431 %!demo |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
432 %! %% Style local/infinite |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
433 %! clf; |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
434 %! [x,y,z] = meshgrid (-.2:0.02:.2, -.2:0.02:.2, -.2:0.02:.2); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
435 %! val = (x.^2 + y.^2 + z.^2); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
436 %! |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
437 %! h_axes1 = subplot (1,2,1); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
438 %! fv = isosurface (x, y, z, val, .039); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
439 %! h_patch = patch (fv, 'FaceColor', 'r', 'EdgeColor', 'none'); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
440 %! isonormals (x, y, z, val, h_patch); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
441 %! title ('"Style" set to "infinite" (default)'); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
442 %! h_light = light ('Position', [.3 0 .3]); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
443 %! lighting gouraud |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
444 %! axis equal |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
445 %! view (3); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
446 %! |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
447 %! h_axes2 = subplot (1,2,2); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
448 %! fv = isosurface (x, y, z, val, .039); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
449 %! h_patch = patch (fv, 'FaceColor', 'r', 'EdgeColor', 'none'); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
450 %! isonormals (x, y, z, val, h_patch); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
451 %! title ('"Style" set to "local"'); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
452 %! h_light = light ('Style', 'local', 'Position', [.3 0 .3]); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
453 %! lighting gouraud |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
454 %! axis equal |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
455 %! view (3); |
20b225a3ebf8
Update to light (patch #8943)
Markus Mützel <markus.muetzel@gmx.de>
parents:
22151
diff
changeset
|
456 |
21789
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
457 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
458 %!test |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
459 %! hf = figure ("Visible", "off"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
460 %! unwind_protect |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
461 %! h = light (); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
462 %! assert (findobj (hf, "Type", "light"), h); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
463 %! assert (get (h, "Position"), [1, 0, 1]); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
464 %! assert (get (h, "Color"), [1, 1, 1]); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
465 %! assert (get (h, "Style"), "infinite"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
466 %! unwind_protect_cleanup |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
467 %! close (hf); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
468 %! end_unwind_protect |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
469 |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
470 %!test |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
471 %! hf = figure ("Visible", "off"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
472 %! ha = gca; |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
473 %! unwind_protect |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
474 %! h = light (ha, "Position", [1 2 3], "Color", "r"); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
475 %! assert (get (h, "Position"), [1 2 3]); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
476 %! assert (get (h, "Color"), [1 0 0]); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
477 %! unwind_protect_cleanup |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
478 %! close (hf); |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
479 %! end_unwind_protect |
6afdf40be534
Implement graphics object "light" (patch #8943).
mmuetzel <markus.muetzel@gmx.de>
parents:
diff
changeset
|
480 |