mtex icon indicating copy to clipboard operation
mtex copied to clipboard

Ellipsoid for rank 2 tensors

Open kilir opened this issue 6 years ago • 0 comments

Hi Ralf, while trying to plot a "shape" representing the magnitude of a rank 2 tensor (which of course makes only sense if all values have the same sign, but a strain or certain stress ellipsoids would the thing I'd have in mind - a shape where radius/distance form center represents the magnitude for this direction), I sort of thought directionalMagnitude would present that - which it obviously doesn't (giving the magnitude in the coordiante system but not with respect to the center of the "thing"):

m= diag([3,2,1])
s = tensor(m)
plot(s)
nextAxis

% plot function values as radius of sphere
sT = directionalMagnitude(s)
surf(sT)
nextAxis
% which is identical to what S2Fun/surf does
% nextAxis
% [x,y,z] = sphere(90);
% S2 = vector3d(x,y,z);
% d = reshape(sT.eval(S2),size(S2, 1), size(S2, 2), []);  
% [x,y,z] = double(abs(d).*S2);
% surf(x,y,z,d)
% axis equal

% some ways to get an ellipoisd
v=equispacedS2Grid('resolution',2*degree)
dm= EinsteinSum(s,[-1 1],v.normalize,-1); % directional magnitude
dm=dm.M;
scatter3(dm(1,:), dm(2,:), dm(3,:),[],eval(sT,v),'filled') % this plot is a little ugly 
axis equal
nextAxis
% or in case one assumes it would be an ellipse
sp=eig(s)
[x, y, z] = ellipsoid(0,0,0,sp(3),sp(2),sp(1),50);
c=norm(vector3d(x,y,z));
surf(x, y, z,c)
colorbar
axis equal

produces the following: blobs

So, would it be useful to have some sort of radius-as-magnitude plotting option as well?

Cheers, Rüdiger

kilir avatar Mar 07 '18 23:03 kilir