-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add angular contribution in the computation of the integral of Jc (#16)
- Loading branch information
1 parent
4f5f723
commit 154cd67
Showing
7 changed files
with
108 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
function rotm = getRotmGivenQuat(quat) | ||
|
||
qw = quat(1); | ||
qxyz = quat(2:4); | ||
|
||
rotm = eye(3)+2*qw*mystica.utils.skew(qxyz)+2*mystica.utils.skew(qxyz)^2; | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function quat_b_a = invQuat(quat_a_b) | ||
|
||
qw = quat_a_b(1); qxyz = quat_a_b(2:4); | ||
quat_b_a = [qw;-qxyz]/(norm(quat_a_b)^2); | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function theta = logQuat(quat,input) | ||
arguments | ||
quat | ||
input.selectQuat char {mustBeMember(input.selectQuat,{'positive','minDistance','normal'})} = 'normal' | ||
end | ||
qw = quat(1); qxyz = quat(2:4); | ||
switch input.selectQuat | ||
case 'normal' | ||
normV = norm(qxyz,2)+eps; | ||
theta = 2 * qxyz * atan2(normV,qw)/normV; | ||
case 'positive' | ||
quat = -quat*(qw<0)+quat*(qw>=0); | ||
theta = mystica.rbm.logQuat(quat,'selectQuat','normal'); | ||
case 'minDistance' | ||
theta1 = mystica.rbm.logQuat( quat,'selectQuat','normal'); n1 = norm(theta1,2); | ||
theta2 = mystica.rbm.logQuat(-quat,'selectQuat','normal'); n2 = norm(theta2,2); | ||
theta = theta1*(n1<=n2)+theta2*(n2<n1); | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function quat = multiplyQuat(quat1,quat2) | ||
|
||
qw1 = quat1(1); qxyz1 = quat1(2:4); | ||
qw2 = quat2(1); qxyz2 = quat2(2:4); | ||
|
||
pw = qw1*qw2 - qxyz1'*qxyz2; | ||
pxyz = qw1*qxyz2 + qw2*qxyz1 + cross(qxyz1,qxyz2); | ||
|
||
quat = [pw;pxyz]; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
function x = skewVee(X) | ||
% function x = skewVee(X) | ||
% function x = skewVee(X) | ||
|
||
X_skew = (X - X.')/2; | ||
|
||
% X = [ 0 X(1,2) X(1,3); | ||
% -X(1,2) 0 X(2,3); | ||
% -X(1,3) X(2,3) 0 ]; | ||
% X = [ 0 X(1,2) X(1,3); | ||
% -X(1,2) 0 X(2,3); | ||
% -X(1,3) X(2,3) 0 ]; | ||
|
||
% X = [ 0 -x(3) x(2); | ||
% x(3) 0 -x(1); | ||
% -x(2) x(1) 0 ]; | ||
% X = [ 0 -x(3) x(2); | ||
% x(3) 0 -x(1); | ||
% -x(2) x(1) 0 ]; | ||
|
||
|
||
x = [-X_skew(2,3);... | ||
X_skew(1,3);... | ||
-X_skew(1,2)]; | ||
x = [-X_skew(2,3);X_skew(1,3);-X_skew(1,2)]; | ||
|
||
end |