Aufgrund eines Versionsupdates wird GitLab am 17.12. zwischen 9:00 und 9:30 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to a version upgrade, GitLab won't be accessible at 17.12. between 9 and 9:30 a.m.

Commit 56c253a0 authored by Marco Berzborn's avatar Marco Berzborn

some more cleanup in SH app

parent 17a0d400
function ita_plot_dots(sampling, varargin)
% <ITA-Toolbox>
% This file is part of the application SphericalHarmonics for the ITA-Toolbox. All rights reserved.
% You can find the license for this m-file in the application folder.
% </ITA-Toolbox>
% color is optional
% 'symbol', 'o'
if nargin == 0, error; end;
sampling = makeCart(sampling);
% if isempty(color)
% % default: black color
% color = 0 * sampling.r;
% end
nDots = size(sampling.x,1);
paraStruct = ita_sph_plot_parser(varargin);
colorValue = paraStruct.dotColor;
%% set the color ranges
if isempty(paraStruct.caxis)
% there are no defined caxis preferences
if length(colorValue) == nDots
% obviously the colorValue is a continuous color entry
% so use it:
cminmax = [min(colorValue) max(colorValue)];
else
% use given caxis
cminmax = caxis;
end
else
% use input parameter for colormap
cminmax = paraStruct.caxis;
end
cmin = cminmax(1);
cmax = cminmax(2);
caxis([cmin cmax]);
%% set colormap
cmap = colormap;
nCmap = size(cmap,1);
%% set the colorRGB values
if all(size(colorValue) == [1 3]);
% the given color seems to be a RGB color
% enlarge to number of dots
% colorRGB = colorValue(ones(nDots,1),:);
colorRGB = colorValue;
elseif length(colorValue) == nDots;
% specific colors are given
% convert to used colorMap
index = fix((colorValue-cmin)/(cmax-cmin)*(nCmap-1))+1;
indexBound = max(min(index,nCmap),1);
colorRGB = cmap(indexBound,:);
else
error('invalid colors given')
end
hold on
if length(colorRGB) == 3
% only one color
iPoints = 1:nDots;
colorMarker = colorRGB;
x = sampling.x(iPoints);
y = sampling.y(iPoints);
z = sampling.z(iPoints);
plot3(x, y, z, paraStruct.symbol, 'MarkerEdgeColor',paraStruct.MarkerEdgeColor, ...
'MarkerFaceColor', colorMarker,'MarkerSize',paraStruct.MarkerSize);
else
% every point has a color
for iColor = 1:nCmap
iPoints = (indexBound == iColor);
if any(iPoints)
% use the color of first point (as all are equal anyway)
colorMarker = colorRGB(find(iPoints,1),:);
x = sampling.x(iPoints);
y = sampling.y(iPoints);
z = sampling.z(iPoints);
plot3(x, y, z, paraStruct.symbol, 'MarkerEdgeColor',paraStruct.MarkerEdgeColor, ...
'MarkerFaceColor', colorMarker,'MarkerSize',paraStruct.MarkerSize);
end
end
end
% now set xlim, ylim & zlim
% maxlimold = max([xlimold(2) ylimold(2) zlimold(2)]);
% maxlimnew = max(max(sampling.cart));
% maxlim = max(maxlimold, maxlimnew);
% maxVal = max(max(sampling.cart));
% % range(2,:) = [min(sampling.y) max(sampling.y)];
% % range(3,:) = [min(sampling.z) max(sampling.z)];
%
% factor = 1.2;
% range = [-maxVal maxVal] * factor;
%
% xlim(range);
% ylim(range);
% zlim(range);
colorbar;
axis vis3d
view(3);
rotate3d;
daspect([1 1 1]);
xlabel('x');
ylabel('y');
zlabel('z');
grid on
hold off
\ No newline at end of file
......@@ -8,18 +8,14 @@ function ita_sph_sampling
[pathstr, name] = fileparts(mfilename('fullpath'));
% samplingMap = ita_io_get_daughter(pathstr, name);
fileNameList = dir(fullfile(pathstr, name, [name '_*.m']));
fileNameList = dir(fullfile(pathstr, [name '_*.m']));
nFiles = numel(fileNameList);
samplingList = '';
for ind = 1:nFiles
% add a | and the name of the file without .m
samplingList = [samplingList '|' fileNameList(ind).name(1:end-2)];
samplingList = [samplingList '|' fileNameList(ind).name(1:end-2)]; %#ok<AGROW>
end
% TODO: use persisitent variable to make list faster
pList = [];
......@@ -36,23 +32,16 @@ ele = length(pList) + 1;
pList{ele}.description = 'maximum Order';
pList{ele}.helptext = '...' ;
pList{ele}.datatype = 'int';
pList{ele}.default = 0;
pList{ele}.default = [];
ele = length(pList) + 1;
pList{ele}.datatype = 'line';
% % GUI name of result
% ele = length(pList) + 1;
% pList{ele}.description = 'Name of Result'; %this text will be shown in the GUI
% pList{ele}.helptext = 'The result will be exported to your workspace with the variable name specified here';
% pList{ele}.datatype = 'text';
% pList{ele}.default = ['result_' mfilename];
%call gui
parameterList = ita_parametric_GUI(pList,[mfilename ' - How you sample the sphere today?']);
parameterList = ita_parametric_GUI(pList,[mfilename ' - How do you want to sample the sphere today?']);
if ~isempty(parameterList)
s = eval([parameterList{1} '(' num2str(parameterList{2}) ')']);
ita_setinbase('sampling', s);
scatter(s,'SizeData', s.weights ./ mean(s.weights) * 10);
scatter(s);
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment