-
Notifications
You must be signed in to change notification settings - Fork 1
/
function_check_dim.m
49 lines (36 loc) · 1.24 KB
/
function_check_dim.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function [coordinate_of_p_3D] = function_check_dim(coordinate_of_p)
% Author: Ke(Ken)WANG from Macao Polytechnic Institute
% Email: ke.wang@ipm.edu.mo, kewang0225@gmail.com
% Update infomation: v0.1(2020/11/20), v0.2(2021/08/26)
%
% This function aims to check the 3D coordinate; We define
% each row of a matrix stands for a 3D coordinate. In other words, coordinate_of_p_3D
% must be a 3 x X matrix.
%
% License: This code is licensed under the GPLv2 license. If you in any way
% use this code for research that results in publications, please cite our
% original article.
%
% The INPUT is the coordinate and the OUTPUT is a 3D coordinate.
%
% Example:
%
% coordinate_of_p = eye(2,3); function_check_dim(coordinate_of_p)
%
% ans =
%
% 1 0 0
% 0 1 0
size_coordinate_of_p = size(coordinate_of_p);
if ismatrix(coordinate_of_p)
if size_coordinate_of_p(2) == 3
coordinate_of_p_3D = coordinate_of_p;
elseif size_coordinate_of_p(1) == 3
coordinate_of_p_3D = coordinate_of_p.';
else
error('The input is NOT an Euclidean vector.')
end
else
error('Only matrix supported.')
end
end