Skip to content

Commit

Permalink
docu
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfHielscher committed Feb 4, 2019
1 parent b66bd03 commit b763cdc
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 108 deletions.
15 changes: 14 additions & 1 deletion PoleFigureAnalysis/@PoleFigure/cat.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
function pf = cat(dim,varargin)
%
% implement cat for PoleFigure
%
% Syntax
% pf = cat(dim,pf1,pf2,pf3)
%
% Input
% dim - dimension
% pf1, pf2, pf3 - @PoleFigure
%
% Output
% pf - @PoleFigure
%
% See also
% PoleFigure/horzcat, PoleFigure/vertcat

% concatenate properties
pf = cat@dynProp(dim,varargin{:});
Expand Down
3 changes: 3 additions & 0 deletions S2Fun/@S2FunTri/mean.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
function value = mean(sF1)
% mean value of a spherical function
%


value = mean(sF1.values(:));

Expand Down
130 changes: 29 additions & 101 deletions doc/FunctionReference/classes/spinTensor_index.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
%
%% Spin Tensors as Ininitesimal Changes of Rotations
%
% Spin tensors are skew symmetric tensors that can be used to small
% rotational changes. Lets consider an arbitrary reference rotation
% Spin tensors are skew symmetric tensors that can be used to approximate
% small rotational changes. Lets consider an arbitrary reference rotation

rot_ref = rotation.byEuler(10*degree,20*degree,30*degree)

%%
% and pertube it by a rotating about the axis (123) and angle delta. Since
% multiplication of rotations is not communatativ we have to distinguish
% multiplication of rotations is not commutativ we have to distinguish
% between left and right pertubations

delta = 0.01*degree;
Expand Down Expand Up @@ -60,41 +60,48 @@

inv(rot_ref) * vector3d(spinTensor(S_left_R)) * sqrt(14)

%% The Functions Exp and Log
%% The Functions Log
%
% The above definition of the spin tensor works only well if the
% pertupation rotation has small rotational angle. For large pertubations
% the matrix logarithm



% Given a reference rotation rot_ref and a spin vector |s| one could ask
% for the rotation that is obtained by applying the inifitimal change s to
% to rot_ref
% the matrix logarithm is the accurate way to compute the skew symmetric
% matrix, i.e., the spinTensor, of the rotational change between an
% reference orientation and another orientation.

rot_123 = rotation.byAxisAngle(vector3d(1,2,3),57.3*degree)
S = logm(rot_ref * rot_123,rot_ref)

rot_123 = rotation.byAxisAngle(vector3d(1,2,3),1)
log(rot_ref * rot_123,rot_ref) * sqrt(14)
S = logm(rot_123 * rot_ref,rot_ref,'left')

log(rot_123 * rot_ref,rot_ref,'left') * sqrt(14)
%%
% Again we may extract the rotational axis directly from the spin tensor

%% logarithm to skew symmetric matrix
% the rotational axis
vector3d(S) * sqrt(14)

S = logm(rot_ref * rot_123,rot_ref)
% the rotational angle in degree
norm(vector3d(S)) / degree

vector3d(S) * sqrt(14)
%%
% Alternatively, we may compute the misorientation vector directly by

S = logm(rot_123 * rot_ref,rot_ref,'left')
vector3d(S) * sqrt(14)
v = log(rot_ref * rot_123,rot_ref); v * sqrt(14)

log(rot_123 * rot_ref,rot_ref,'left') * sqrt(14)

%% The other way round
%% The Exponential Function Exp
%
% The exponential function is the inverse of function of the logarithm and
% hence it takes a spinTensor or a misorientation vector it turns it into a
% misorientation.

S = logm(rot_ref * rot_123,rot_ref);
% applying a misorientation directly to the reference orientation
rot_ref * rot_123

% do the same with spinTensor
exp(S,rot_ref)

v = log(rot_ref * rot_123,rot_ref);
% do the same with the misorientation vector
exp(v,rot_ref)

%%
Expand Down Expand Up @@ -175,82 +182,3 @@




v = vector3d.rand(100);
v.x = 0;
v = rotation.rand * v + vector3d.rand;

vsave = v;

%%

s = v(1);

% shift to origin
v = v - s;

% compute normal vector
[n,~] = eig3(v*v);


r = rotation.map(n(1),zvector);

v = r * v;

plot3(v.x,v.y,v.z,'.')

%%

P = [v.x(:),v.y(:)];
T = delaunayn(P);
n = size(T,1);
W = zeros(n,1);
C=0;
for m = 1:n
sp = P(T(m,:),:);
[null,W(m)]=convhulln(sp);
C = C + W(m) * mean(sp);
end

C = vector3d(C(1),C(2),0)./sum(W);



%%

hold on
plot3(C.x,C.y,C.z,'MarkerSize',10)
hold off




function test
% some testing code

cs = crystalSymmetry('321');
ori1 = orientation.rand(cs);
ori2 = orientation.rand(cs);

v = log(ori2,ori1);

% this should be the same
[norm(v),angle(ori1,ori2)] ./ degree

% and this too
[ori1 * orientation.byAxisAngle(v,norm(v)) ,project2FundamentalRegion(ori2,ori1)]

% in specimen coordinates
r = log(ori2,ori1,'left');

% now we have to multiply from the left
[rotation.byAxisAngle(r,norm(v)) * ori1 ,project2FundamentalRegion(ori2,ori1)]

% the following output should be constant
% gO = log(ori1,ori2.symmetrise) % but not true for this
% gO = log(ori1.symmetrise,ori2) % true for this
%
% gO = ori2.symmetrise .* log(ori1,ori2.symmetrise) % true for this
% gO = ori2 .* log(ori1.symmetrise,ori2) % true for this

end
3 changes: 2 additions & 1 deletion geometry/@S2Grid/cat.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
function v = cat(dim,varargin)
%
% implements cat for S2Grid
%

v = cat(dim,vector3d(varargin{1}),varargin{2:end});
2 changes: 2 additions & 0 deletions geometry/@crystalShape/repmat.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function cS =repmat(cS,varargin)
% implements repmat for crystalShape
%

n = prod([varargin{:}]);

Expand Down
15 changes: 14 additions & 1 deletion geometry/@dislocationSystem/cat.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
function dS = cat(dim,varargin)
%
% implement cat for dislocationSystem
%
% Syntax
% dS = cat(dim,dS1,dS2,dS3)
%
% Input
% dim - dimension
% dS1, dS2, dS3 - @dislocationSystem
%
% Output
% dS - @dislocationSystem
%
% See also
% dislocationSystem/horzcat, dislocationSystem/vertcat

% remove emtpy arguments
varargin(cellfun('isempty',varargin)) = [];
Expand Down
15 changes: 14 additions & 1 deletion geometry/@fibre/cat.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
function f = cat(dim,varargin)
%
% implement cat for fibre
%
% Syntax
% f = cat(dim,f1,f2,f3)
%
% Input
% dim - dimension
% f1, f2, f3 - @fibre
%
% Output
% f - @fibre
%
% See also
% fibre/horzcat, fibre/vertcat

% remove emtpy arguments
varargin(cellfun('isempty',varargin)) = [];
Expand Down
15 changes: 14 additions & 1 deletion geometry/@quaternion/cat.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
function q = cat(dim,varargin)
%
% implement cat for quaternion
%
% Syntax
% q = cat(dim,q1,q2,q3)
%
% Input
% dim - dimension
% q1, q2, q3 - @quaternion
%
% Output
% q - @quaternion
%
% See also
% quaternion/horzcat, quaternion/vertcat

q = varargin{1};

Expand Down
13 changes: 13 additions & 0 deletions geometry/@rotation/cat.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
function r = cat(dim,varargin)
% implement cat for rotation
%
% Syntax
% r = cat(dim,r1,r2,r3)
%
% Input
% dim - dimension
% r1, r2, r3 - @rotation
%
% Output
% r - @rotation
%
% See also
% rotation/horzcat, rotation/vertcat

% remove emtpy arguments
varargin(cellfun('isempty',varargin)) = [];
Expand Down
15 changes: 14 additions & 1 deletion geometry/@slipSystem/cat.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
function sS = cat(dim,varargin)
%
% implement cat for slipSystem
%
% Syntax
% sS = cat(dim,sS1,sS2,sS3)
%
% Input
% dim - dimension
% sS1, sS2, sS3 - @slipSystem
%
% Output
% sS - @slipSystem
%
% See also
% slipSystem/horzcat, slipSystem/vertcat

% remove emtpy arguments
varargin(cellfun('isempty',varargin)) = [];
Expand Down
17 changes: 16 additions & 1 deletion geometry/@vector3d/cat.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
function v = cat(dim,varargin)
%
% implement cat for vector3d
%
% Syntax
% v = cat(dim,v1,v2,v3)
%
% Input
% dim - dimension
% v1, v2, v3 - @vector3d
%
% Output
% v - @vector3d
%
% See also
% vector3d/horzcat, vector3d/vertcat


% remove emtpy arguments
varargin(cellfun('isempty',varargin)) = [];
Expand All @@ -12,6 +26,7 @@
vx{i} = vs.x;
vy{i} = vs.y;
vz{i} = vs.z;
v.isNormalized = v.isNormalized & vs.isNormalized;
end
end

Expand Down
1 change: 1 addition & 0 deletions geometry/@vector3d/smooth.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
function [h,ax] = smooth(v,varargin)
% low level function for plotting functions on the sphere
%
% Syntax
%
Expand Down

0 comments on commit b763cdc

Please sign in to comment.