-
Notifications
You must be signed in to change notification settings - Fork 7
/
f_calculatewedge.m
109 lines (104 loc) · 3.24 KB
/
f_calculatewedge.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
function [ w,b, angle, posible ] = f_calculatewedge( alphas, betas, alphaj1, betaj1, alphaj2, betaj2 )
% Cálculo de una cuña a partir de su talud y las dos discontinuidades
% Adrián Riquelme, 19 marzo 2015
% alpha y beta en radianes, ya se convierte sólo dentro del código
% w y b en grados
% angle: diferencia de dirección entre el talud y la quilla de la cuña,
% grados
% posible 1 si si o 0 si no
% Copyright (C) {2015} {Adrián Riquelme Guill, adririquelme@gmail.com}
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License along
% with this program; if not, write to the Free Software Foundation, Inc.,
% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
% SMRTool, Copyright (C) 2015 Adrián Riquelme Guill
% SMRTool comes with ABSOLUTELY NO WARRANTY.
% This is free software, and you are welcome to redistribute it
% under certain conditions.
[ A,B,C ] = f_vbuz2vnor( alphas/180*pi,betas/180*pi );
slope=[A,B,C];
[ A,B,C ] = f_vbuz2vnor( alphaj1/180*pi,betaj1/180*pi );
discontinuity1=[A,B,C];
[ A,B,C ] = f_vbuz2vnor( alphaj2/180*pi,betaj2/180*pi );
discontinuity2=[A,B,C];
% la línea es el prod vect de los vn de los planos
line=cross(discontinuity1,discontinuity2);
% hacemos que su componente z sea negativa para saber hacia
% donde buzaría la cuña y compararlo con el slope
if line(3)>0
line=line*(-1);
end
% calculamos el ángulo que forma la cuña con el slope
angle = acos(slope(1:2)*line(1:2)')*180/pi;
angle = round(angle*100)/100;
if angle <0
angle = 180 + angle;
end
% calculamos el azimut y buzamiento del vector de la linea
[w,b]=v2vbuz(line(1),line(2),line(3));
w=round(w*180/pi*100)/100;
b=round(b*180/pi*100)/100;
if angle <= 90
posible=1;
else
posible=0;
end
end
function [ A,B,C ] = f_vbuz2vnor( w,b )
% f_vbuz2vnor, Adrián Riquelme octubre 2013
% [ A,B,C ] = f_vbuz2vnor( w,b )
% Función que toma el vector buzamiento de un plano y devuelve las
% componentes (A,B,C) del vector normal al plano.
A=sin(b).*sin(w);
B=sin(b).*cos(w);
C=cos(b);
% M=[A; B; C];
end
function [w,b]=v2vbuz(ux,uy,uz)
% Función de conversión vector normal a vector buzamiento del plano
% Adrián Riquelme, abril 2013
% [w,b]=v2vbuz(ux,uy,uz)
% Input:
% - componentes del vector normal al plano
% Output:
% - w: ángulo que forma el vector de buzamiento con el eje OY, considerado
% como el norte
% - b: ángulo que forma la línea de máxima pendiente del plano con su
% proyección horizontal.
uxy= (ux^2+uy^2)^(0.5);
bz=uz;
if uxy==0
bx=0;
by=0;
else
bx=ux;
by=uy;
end
bxy = abs(uxy);
if bx>=0 && by>=0
w = atan(bx/by);
end
if bx>0 && by<0
w = pi-atan(abs(bx/by));
end
if bx<=0 && by<=0
w = pi + atan(abs(bx/by));
end
if bx<0 && by>0
w = 2*pi - atan(abs(bx/by));
end
b = - atan(bz/bxy);
if bx==0 ||by==0
w = 0;
end
end