|
1 | | -classdef hjs < matlab.System |
| 1 | +classdef differential_geometry < matlab.System |
2 | 2 | % Untitled Add summary here |
3 | 3 | % |
4 | 4 | % This template includes the minimum set of functions required |
|
16 | 16 | Ricci_tensor; |
17 | 17 | Scalar_curvature; |
18 | 18 | Gauss_curvature; |
19 | | - |
| 19 | + FaceColor; |
20 | 20 | alpha=1; |
21 | 21 | scale=0.9; |
22 | 22 | end |
23 | 23 |
|
24 | 24 |
|
25 | 25 |
|
26 | 26 | methods |
27 | | - function obj = hjs(varargin) |
| 27 | + function obj = differential_geometry(varargin) |
28 | 28 | % Support name-value pair arguments when constructing object |
29 | 29 | setProperties(obj,nargin,varargin{:}) |
30 | 30 | end |
|
132 | 132 | [C,IA,IC]=uniquetol(Xf(DT.Points(:,1)',DT.Points(:,2)',DT.Points(:,1)')'-tXf(DT.Points(:,1)')','ByRows',true); |
133 | 133 | TR=triangulation(IC(DT.ConnectivityList),C); |
134 | 134 | VV=vertexNormal(TR); |
135 | | - lig = light; |
136 | 135 | if(draw_curvature) |
137 | 136 | curvatureF=matlabFunction(obj.Scalar_curvature,'vars',{'u1','u2'}); |
138 | 137 | color=curvatureF(DT.Points(:,1),DT.Points(:,2)); |
139 | 138 | if(numel(color)==1) |
140 | 139 | color=repmat(color,[size(DT.Points,1),1]); |
141 | 140 |
|
142 | 141 | end |
143 | | - pat=patch('Faces',IC(DT.ConnectivityList),'Vertices',C,'FaceVertexCData',color(IA),'FaceColor','interp','EdgeColor','none','VertexNormals',VV,'FaceLighting','gouraud',"FaceAlpha",obj.alpha); |
144 | | - pat.AmbientStrength=1; |
145 | | - pat.DiffuseStrength=1; |
146 | | - pat.SpecularStrength=1; |
147 | | -% pat.SpecularExponent=1; |
148 | | - pat.BackFaceLighting='unlit'; |
| 142 | + pat=patch('Faces',IC(DT.ConnectivityList),'Vertices',C,'FaceVertexCData',color(IA),'FaceColor','interp','EdgeColor','none','VertexNormals',VV,"FaceAlpha",obj.alpha); |
| 143 | + |
| 144 | +% pat.BackFaceLighting='unlit'; |
149 | 145 | colormap parula; |
150 | 146 | view(3); |
151 | 147 |
|
152 | | - |
| 148 | + |
153 | 149 | colorbar; |
154 | 150 | else |
155 | | - pat=patch('Faces',IC(DT.ConnectivityList),'Vertices',C,'FaceVertexCData',C(:,1),'FaceColor','interp','EdgeColor','none','VertexNormals',VV,'FaceLighting','gouraud',"FaceAlpha",obj.alpha); |
156 | | - pat.AmbientStrength=1; |
157 | | - pat.DiffuseStrength=1; |
158 | | - pat.SpecularStrength=1; |
159 | | -% pat.SpecularExponent=1; |
| 151 | + if(isempty(obj.FaceColor)) |
| 152 | + pat=patch('Faces',IC(DT.ConnectivityList),'Vertices',C,'FaceVertexCData',C(:,1),'FaceColor','interp','EdgeColor','none','VertexNormals',VV,'FaceLighting','gouraud',"FaceAlpha",obj.alpha); |
| 153 | + |
| 154 | + else |
| 155 | + pat=patch('Faces',IC(DT.ConnectivityList),'Vertices',C,'FaceColor',obj.FaceColor,'EdgeColor','none','VertexNormals',VV,'FaceLighting','gouraud',"FaceAlpha",obj.alpha); |
| 156 | + |
| 157 | + end |
| 158 | + |
160 | 159 | pat.BackFaceLighting='unlit'; |
161 | 160 | view(3); |
162 | | - |
163 | | - |
| 161 | + camlight; |
| 162 | + material shiny; |
| 163 | + |
164 | 164 | end |
165 | | - lig.Position=-campos; |
166 | | -% camlight; |
| 165 | + |
| 166 | + |
| 167 | + |
167 | 168 | end |
168 | 169 | function []= curvature_tensor(obj) |
169 | 170 | n=obj.n; |
|
0 commit comments