Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Virtual Sensing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SPAH
IN-NOVA
Virtual Sensing
Commits
23d69c18
Commit
23d69c18
authored
10 months ago
by
Achilles Kappis
Browse files
Options
Downloads
Patches
Plain Diff
Combine functionality of rotMat3d.m and rotMat3dDeg.m to the former and remove the latter
parent
7aac2c0e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Utilities/Generic/MATLAB/Functions/rotMat3d.m
+28
-5
28 additions, 5 deletions
Utilities/Generic/MATLAB/Functions/rotMat3d.m
Utilities/Generic/MATLAB/Functions/rotMat3dDeg.m
+0
-85
0 additions, 85 deletions
Utilities/Generic/MATLAB/Functions/rotMat3dDeg.m
with
28 additions
and
90 deletions
Utilities/Generic/MATLAB/Functions/rotMat3d.m
+
28
−
5
View file @
23d69c18
...
...
@@ -3,7 +3,7 @@
% Author: Achilles Kappis
% e-mail: axilleaz@protonmail.com
%
% Date:
03
/0
2
/2024 (DD/MM/YYYY)
% Date:
16
/0
7
/2024 (DD/MM/YYYY)
%
% Copyright: MIT
% --------------------------------------------------
...
...
@@ -17,6 +17,12 @@
%
% zAng [numeric] (Optional) : Rotation angle along the z-axis.
% [Default: 0].
%
% radDeg [chat/string] (Optional): This value declares if the provided
% angles are in radians or degrees. It can
% have one of the following values and is
% not case sensitive: "Degs", "Degrees",
% "Rads", "Radians". [Default: "Rads"].
% --------------------------------------------------
% Output
%
...
...
@@ -34,11 +40,11 @@
% Notes
%
% --------------------------------------------------
function
[
rotMat
,
xRotMat
,
yRotMat
,
zRotMat
]
=
rotMat3d
(
xAng
,
yAng
,
zAng
)
function
[
rotMat
,
xRotMat
,
yRotMat
,
zRotMat
]
=
rotMat3d
(
xAng
,
yAng
,
zAng
,
radDeg
)
% ====================================================
% Check for number of arguments
% ====================================================
narginchk
(
1
,
3
);
narginchk
(
1
,
4
);
nargoutchk
(
0
,
4
);
% ====================================================
...
...
@@ -48,18 +54,35 @@ function [rotMat, xRotMat, yRotMat, zRotMat] = rotMat3d(xAng, yAng, zAng)
validateattributes
(
xAng
,
"numeric"
,
{
'scalar'
,
'nonnan'
,
'finite'
,
'real'
},
mfilename
,
'Roll angle'
,
1
);
% Optional arguments
if
nargin
>
1
if
nargin
>
1
&&
~
isempty
(
yAng
)
validateattributes
(
yAng
,
"numeric"
,
{
'scalar'
,
'nonnan'
,
'finite'
,
'real'
},
mfilename
,
'Pitch angle'
,
2
);
else
yAng
=
0
;
end
if
nargin
>
2
if
nargin
>
2
&&
~
isempty
(
zAng
)
validateattributes
(
zAng
,
"numeric"
,
{
'scalar'
,
'nonnan'
,
'finite'
,
'real'
},
mfilename
,
'Yaw angle'
,
2
);
else
zAng
=
0
;
end
if
nargin
>
3
&&
~
isempty
(
radDeg
)
validateattributes
(
radDeg
,
{
'char'
,
'string'
},
{
'scalartext'
},
mfilename
,
"The 'type' of the provided angle values (radians or degrees)"
,
4
);
validatestring
(
radDeg
,
[
"Rads"
,
"Radians"
,
"Degs"
,
"Degrees"
],
mfilename
,
"The 'type' of the provided angle values (radians or degrees)"
,
4
);
else
radDeg
=
"Rads"
;
end
% ====================================================
% Pre-process angle values
% ====================================================
if
sum
(
strcmpi
(
radDeg
,
[
"Degs"
,
"Degrees"
]))
>
0
xAng
=
deg2rad
(
xAng
);
yAng
=
deg2rad
(
yAng
);
zAng
=
deg2rad
(
zAng
);
end
% ====================================================
% Create respective matrices
...
...
This diff is collapsed.
Click to expand it.
Utilities/Generic/MATLAB/Functions/rotMat3dDeg.m
deleted
100644 → 0
+
0
−
85
View file @
7aac2c0e
%% Calculate a 3D rotation matrix
% --------------------------------------------------
% Author: Achilles Kappis
% e-mail: axilleaz@protonmail.com
%
% Date: 03/02/2024 (DD/MM/YYYY)
%
% Copyright: MIT
% --------------------------------------------------
% Functionality: Calculate a 3D rotation matrix.
% --------------------------------------------------
% Input
%
% xAng [numeric]: Rotation angle along the x-axis in degrees.
%
% yAng [numeric] (Optional): Rotation angle along the y-axis in degrees.
% [Default: 0].
%
% zAng [numeric] (Optional) : Rotation angle along the z-axis in degrees.
% [Default: 0].
% --------------------------------------------------
% Output
%
% rotMat [numeric]: A 3x3 matrix which applies the rotation.
%
% xRotMat[numeric]: A 3x3 matrix which applies the rotation along the
% x-axis.
%
% yRotMat[numeric]: A 3x3 matrix which applies the rotation along the
% y-axis.
%
% zRotMat[numeric]: A 3x3 matrix which applies the rotation along the
% z-axis.
% --------------------------------------------------
% Notes
%
% --------------------------------------------------
function
[
rotMat
,
xRotMat
,
yRotMat
,
zRotMat
]
=
rotMat3dDeg
(
xAng
,
yAng
,
zAng
)
% ====================================================
% Check for number of arguments
% ====================================================
narginchk
(
1
,
3
);
nargoutchk
(
0
,
4
);
% ====================================================
% Validate input arguments
% ====================================================
% Mandatory arguments
validateattributes
(
xAng
,
"numeric"
,
{
'scalar'
,
'nonnan'
,
'finite'
,
'real'
},
mfilename
,
'Roll angle'
,
1
);
% Optional arguments
if
nargin
>
1
validateattributes
(
yAng
,
"numeric"
,
{
'scalar'
,
'nonnan'
,
'finite'
,
'real'
},
mfilename
,
'Pitch angle'
,
2
);
else
yAng
=
0
;
end
if
nargin
>
2
validateattributes
(
zAng
,
"numeric"
,
{
'scalar'
,
'nonnan'
,
'finite'
,
'real'
},
mfilename
,
'Yaw angle'
,
2
);
else
zAng
=
0
;
end
% ====================================================
% Create respective matrices
% ====================================================
% Rolling rotation matrix
xRotMat
=
[
1
,
0
,
0
;
...
0
,
cosd
(
xAng
),
-
sind
(
xAng
);
...
0
,
sind
(
xAng
),
cosd
(
xAng
)];
% Pitch rotation matrix
yRotMat
=
[
cosd
(
yAng
),
0
,
sind
(
yAng
);
...
0
,
1
,
0
;
...
-
sind
(
yAng
),
0
,
cosd
(
yAng
)];
% Yaw rotation matrix
zRotMat
=
[
cosd
(
zAng
),
-
sind
(
zAng
),
0
;
...
sind
(
zAng
),
cosd
(
zAng
),
0
;
...
0
,
0
,
1
];
% Complete rotation matrix
rotMat
=
zRotMat
*
yRotMat
*
xRotMat
;
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment