-
Notifications
You must be signed in to change notification settings - Fork 1
/
drawH.m
42 lines (36 loc) · 1.92 KB
/
drawH.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
% BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
% FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
% OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
% PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
% OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
% MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
% TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
% PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
% REPAIR OR CORRECTION.
%
% 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
% WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
% REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
% INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
% OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
% TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
% YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
% PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
% POSSIBILITY OF SUCH DAMAGES.
function out = drawH(H, s, t, c)
v1 = [H(1,4);H(2,4);H(3,4)];
v2 = v1 + s*[H(1,1);H(2,1);H(3,1)];
v3 = v1 + s*[H(1,2);H(2,2);H(3,2)];
v4 = v1 + s*[H(1,3);H(2,3);H(3,3)];
out.hx = line([v1(1),v2(1)] , [v1(2),v2(2)] , [v1(3),v2(3)]);
out.hy = line([v1(1),v3(1)] , [v1(2),v3(2)] , [v1(3),v3(3)]);
out.hz = line([v1(1),v4(1)] , [v1(2),v4(2)] , [v1(3),v4(3)]);
vadd = [H(1,1);H(2,1);H(3,1)] + [H(1,2);H(2,2);H(3,2)] + [H(1,3);H(2,3);H(3,3)];
textloc = v1 - 0.2*vadd;
out.htext = text(textloc(1),textloc(2),textloc(3),t);
%set line properties
set(out.hx,'Color',[0 0 0],'LineWidth',2);
set(out.hy,'Color',c,'LineWidth',2);
set(out.hz,'Color',c,'LineWidth',2);
%set text properties
set(out.htext,'Color',c);