comparison scripts/plot/draw/surfl.m @ 18434:92ec75319e73

surfl.m: normalize using dataaspectratio, not plotboxaspectratio. * surfl.m: Calculations of normals to surface now use dataaspectratio to determine length, rather than plotboxaspectratio. Modified %!demo to showcase surfl and the differences when using the light vector and material properties inputs to surfl.
author Rik <rik@octave.org>
date Thu, 06 Feb 2014 18:05:09 -0800
parents d63878346099
children 0e1f5a750d00
comparison
equal deleted inserted replaced
18430:07ca8b9f8cab 18434:92ec75319e73
162 0, 0, 1]; 162 0, 0, 1];
163 lv = (R * vv.').'; 163 lv = (R * vv.').';
164 endif 164 endif
165 165
166 vn = get (htmp, "vertexnormals"); 166 vn = get (htmp, "vertexnormals");
167 dar = get (hax, "plotboxaspectratio"); 167 dar = get (hax, "dataaspectratio");
168 vn(:,:,1) *= dar(1); 168 vn(:,:,1) *= dar(1);
169 vn(:,:,2) *= dar(2); 169 vn(:,:,2) *= dar(2);
170 vn(:,:,3) *= dar(3); 170 vn(:,:,3) *= dar(3);
171 171
172 ## Normalize vn. 172 ## Normalize vn.
204 204
205 %!demo 205 %!demo
206 %! clf; 206 %! clf;
207 %! [X,Y,Z] = sombrero (); 207 %! [X,Y,Z] = sombrero ();
208 %! colormap (copper (64)); 208 %! colormap (copper (64));
209 %! [az, el] = view (); 209 %! surfl (X,Y,Z, [62.50,30], [0.2 0.6 0.4 25]);
210 %! surfl (X,Y,Z, [az+225,el], [0.2 0.6 0.4 25]);
211 %! shading interp; 210 %! shading interp;
212 %! title ('surfl() with lighting vector and material properties'); 211 %! title ('surfl() with lighting vector and material properties');
213 212