Switch to unified view

a b/tool_funcs/createTorsionProfile.m
1
%-------------------------------------------------------------------------%
2
%    Copyright (c) 2021 Modenese L.                                       %
3
%    Author:   Luca Modenese,  2021                                       %
4
%    email:    l.modenese@imperial.ac.uk                                  %
5
% ----------------------------------------------------------------------- %
6
7
function [torsion_angle_func_rad, torsion_doc_string] = createTorsionProfile(LengthProfilePoints, TorsionProfilePointsDeg, torsionAxis)
8
9
disp('--------------------------');
10
disp(' CREATING TORSION PROFILE ');
11
disp('--------------------------');
12
13
% get axis indices
14
[~, axis_ind] = getAxisRotMat(torsionAxis);
15
16
disp(['Axis of torsion: ', upper(torsionAxis)]);
17
disp('Profile (Tors Point, Coordinate)')
18
19
% pointProfile on axis of interest
20
axis_LengthProfilePoints = LengthProfilePoints(:, axis_ind)';
21
22
for np = 1:length(TorsionProfilePointsDeg)
23
    disp([num2str(TorsionProfilePointsDeg(np)), '   deg     |------> ' num2str(axis_LengthProfilePoints(np))]);
24
end
25
26
% create implicit function for calculating torsion at a certain quote
27
torsion_angle_func_rad = @(L)torsionProfile(L, axis_LengthProfilePoints, TorsionProfilePointsDeg);
28
29
% round degrees of torsion at joints
30
torsion_bounds_deg = round([torsion_angle_func_rad(axis_LengthProfilePoints(1)) torsion_angle_func_rad(axis_LengthProfilePoints(2))]*180/pi);
31
32
% strings to use for naming models
33
torsion_doc_string = ['Prox',num2str(torsion_bounds_deg(1)),'Dist',num2str(torsion_bounds_deg(2)),'Deg'];
34
35
end
36