91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-05-14
  • 語言: Matlab
  • 標簽: 未分類??

資源簡介

matlab開發-scatter3sph。散射3SPH繪制具有不同大小和顏色的三維球體的三維散射圖

資源截圖

代碼片段和文件信息

function?scatter3sph(XYZvarargin)
%SCATTER3SPH?(XYZ)?Makes?a?3d?scatter?plot?with?3D?spheres
% SCATTER3SPH?is?like?scatter3?only?drawing?spheres?instead
% of?flat?circles?at?coordinates?specified?by?vectors?X?Y?Z.?All?three
% vectors?have?to?be?of?the?same?length.
% SCATTER3SPH(XYZ)?draws?the?spheres?with?the?default?size?and?color.
% SCATTER3SPH(XYZ‘size‘S)?draws?the?spheres?with?sizes?S.?If?length(S)=?1
% the?same?size?is?used?for?all?spheres.
% SCATTER3SPH(XYZ‘color‘C)?draws?the?spheres?with?colors?speciffied?in?a
% N-by-3?matrix?C?as?RGB?values.
% SCATTER3SPH(XYZ‘transp‘T)?applies?transparency?level?‘T‘?to?the?spheres
% T=?0?=>?transparent?T=?1?=>?opaque.
% Parameter?names?can?be?abreviated?to?3?letters.?For?example:?‘siz‘?or?
% ‘col‘.?Case?is?irrelevant.
%
%?Example
%?%Coordinates
%??X=?100*rand(91);?Y=?100*rand(91);?Z=?100*rand(91);
%?
%?%Colors:?3?blue?3?red?and?3?green
%?C=?ones(31)*[0?0?1];
%?C=?[C;ones(31)*[1?0?0]];
%?C=?[C;ones(31)*[0?1?0]];
%?
%?%Sizes
%?S=?5+10*rand(91);
%?
%?scatter3sph(XYZ‘size‘S‘color‘C‘trans‘0.3);
%?axis?vis3d


%--?Some?checking...
if?nargin?if?mean([length(X)length(Y)length(Z)])?~=?length(X)?error?(‘Imput?vectors?X?Y?Z?are?of?different?lengths‘);?return;?end

%--?Defaults
C=?ones(length(X)1)*[0?0?1];
S=?0.1*max([X;Y;Z])*ones(length(X)1);
nfacets=?15;
transp=?0.5;


%--?Extract?optional?arguments
for?j=?1:2:length(varargin)
string=?lower(varargin{j});
switch?string(1:min(3length(string)))
case?‘siz‘
S=?varargin{j+1};
if?length(S)?==?1
S=?ones(length(X)1)*S;
elseif?length(S)? error(‘The?vector?of?sizes?must?be?of?the?same?length?as?coordinate?vectors?(or?1)‘);
return
end

case?‘col‘
C=?varargin{j+1};
if?size(C2)? if?size(C1)?==?1
C=?ones(length(X)1)*C(1:3);
elseif?size(C1)? error(‘Colors?matrix?must?have?the?same?number?of?rows?as?length?of?coordinate?vectors?(or?1)‘);
return
end

case?‘fac‘
nfacets=?varargin{j+1};

case?‘tra‘
transp=?varargin{j+1};

otherwise
error(‘Unknown?parameter?name.?Allowed?names:?‘‘size‘‘?‘‘color‘‘?‘‘facets‘‘?‘‘transparency‘‘?‘);
end
end


%--?Sphere?facets
[sxsysz]=?sphere(nfacets);


%---?Correct?potential?distortion
maxax=?max([range(X)?range(Y)?range(Z)]);
ratios=?[range(X)/maxax?range(Y)/maxax?range(Z)/maxax];
sx=?sx*ratios(1);
sy=?sy*ratios(2);
sz=?sz*ratios(3);


%--?Plot?spheres
hold?on
for?j=?1:length(X)
surf(sx*S(j)+X(j)?sy*S(j)+Y(j)?sz*S(j)+Z(j)...
‘Linestyle‘‘none‘...
‘FaceColor‘C(j:)...
‘FaceAlpha‘transp);
end

daspect([ratios(1)?ratios(2)?ratios(3)]);
light(‘Position‘[1?1?1]‘style‘‘infinit‘‘Color‘[1?1?1]);
lighting?gouraud;
view(3030)


?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????2961??2014-10-02?18:19??scatter3sph.m
?????文件????????1509??2014-10-02?18:19??license.txt

評論

共有 條評論