MATLAB Function Reference |
Amandine 1 0 1 equals. Surface plot with colormap-based lighting
Open Example A modified version of this example exists on your system. Do you want to open this version instead? No, overwrite the modified version Yes Cerca e consulta articoli.
Syntax
Description
The
surfl
function displays a shaded surface based on a combination of ambient, diffuse, and specular lighting models. - I'm using the surfnorm function in Matlab 2012b. Sometimes the normal vectors along one edge of the surface are reversed, but I can't figure out why it is reversing only the vectors at the edge. Below is a sample code with a 3x3 surface patch that results in the reversed vectors along one edge.
- I tried surfnorm, but my data does not have the correct input for surfnorm. I have an STL file with a surface and the x, y and z coordinates for all points. I want to have the normal vector for all points, so I can select the points I am interested in, using the x, y and z coordinates.
surfl(Z) and surfl(X,Y,Z)
create three-dimensional shaded surfaces using the default direction for the light source and the default lighting coefficients for the shading model. X
, Y
, and Z
are vectors or matrices that define the x, y, and z components of a surface.surfl(..,'light')
produces a colored, lighted surface using a MATLAB light object. This produces results different from the default lighting method, surfl(..,'cdata'), which changes the color data for the surface to be the reflectance of the surface.surfl(..,s)
specifies the direction of the light source. s
is a two- or three-element vector that specifies the direction from a surface to a light source. s
=
[sx
sy
sz]
or s
=
[azimuth elevation]
. The default s
is 45° counterclockwise from the current view direction.surfl(X,Y,Z,s,k)
specifies the reflectance constant. k
is a four-element vector defining the relative contributions of ambient light, diffuse reflection, specular reflection, and the specular shine coefficient. k = [ka kd ks shine]
and defaults to [.55,.6,.4,10]
.h = surfl(..)
returns a handle to a surface graphics object.Remarks
For smoother color transitions, use colormaps that have linear intensity variations (e.g.,
gray
, copper
, bone
, pink
).The ordering of points in the
X
, Y
, and Z
matrices define the inside and outside of parametric surfaces. If you want the opposite side of the surface to reflect the light source, use surfl(X',Y',Z')
. Because of the way surface normal vectors are computed, surfl
requires matrices that are at least 3-by-3.Surfnorm Matlab Code
Examples
View
peaks
using colormap-based lighting.To plot a lighted surface from a view direction other than the default.
See Also
colormap
, shading
, light
Creating Surfaces and Meshes for functions related to surfaces
Lighting for functions related to lighting
Matlab Surfnorm Plot
Surface Properties | surfnorm |
MATLAB Function Reference |
Surface plot with colormap-based lighting
Syntax
Description
The
surfl
function displays a shaded surface based on a combination of ambient, diffuse, and specular lighting models. surfl(Z) and surfl(X,Y,Z)
create three-dimensional shaded surfaces using the default direction for the light source and the default lighting coefficients for the shading model. X
, Y
, and Z
are vectors or matrices that define the x, y, and z components of a surface.surfl(..,'light')
produces a colored, lighted surface using a MATLAB light object. This produces results different from the default lighting method, surfl(..,'cdata'), which changes the color data for the surface to be the reflectance of the surface.surfl(..,s)
specifies the direction of the light source. s
is a two- or three-element vector that specifies the direction from a surface to a light source. s
=
[sx
sy
sz]
or s
=
[azimuth elevation]
. The default s
is 45° counterclockwise from the current view direction.surfl(X,Y,Z,s,k)
specifies the reflectance constant. k
is a four-element vector defining the relative contributions of ambient light, diffuse reflection, specular reflection, and the specular shine coefficient. k = [ka kd ks shine]
and defaults to [.55,.6,.4,10]
.![Matlab surfnorm函数 Matlab surfnorm函数](https://josoansi.de/octave_plot_compare_old/Matlab_R2016a/surfnorm_01.png)
h = surfl(..)
returns a handle to a surface graphics object.Remarks
For smoother color transitions, use colormaps that have linear intensity variations (e.g.,
gray
, copper
, bone
, pink
).The ordering of points in the
X
, Y
, and Z
matrices define the inside and outside of parametric surfaces. If you want the opposite side of the surface to reflect the light source, use surfl(X',Y',Z')
. Because of the way surface normal vectors are computed, surfl
requires matrices that are at least 3-by-3.Matlab Surfnorm
Examples
Matlab Surfnorm函数
View
peaks
using colormap-based lighting.To plot a lighted surface from a view direction other than the default.
See Also
colormap
, shading
, light
Creating Surfaces and Meshes for functions related to surfaces
Lighting for functions related to lighting
Surface Properties | surfnorm |