-
Notifications
You must be signed in to change notification settings - Fork 0
/
Planes_stereonet_intersection.py
54 lines (42 loc) · 1.57 KB
/
Planes_stereonet_intersection.py
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
#Definition of inputs and outputs
#==================================
##[Mes scripts GEOL]=group
##strati=vector
##dip_dir=field strati
##dip=field strati
##schisto=vector
##dip_dir2=field schisto
##dip2=field schisto
#Algorithm body
from qgis.core import *
from apsg import *
layer = processing.getObject(strati)
dipdir = layer.fieldNameIndex(dip_dir)
dip = layer.fieldNameIndex(dip)
if layer.selectedFeatureCount():
g= Group([Vec3(Fol(elem.attributes()[dipdir],elem.attributes()[dip])) for elem in layer.selectedFeatures()],name='plis')
else:
g= Group([Vec3(Fol(elem.attributes()[dipdir],elem.attributes()[dip])) for elem in layer.getFeatures()],name='plis')
print g
layer2 = processing.getObject(schisto)
dipdir2 = layer2.fieldNameIndex(dip_dir2)
dip2 = layer2.fieldNameIndex(dip2)
if layer2.selectedFeatureCount():
g2= Group([Vec3(Fol(elem.attributes()[dipdir2],elem.attributes()[dip2])) for elem in layer2.selectedFeatures()],name='schisto')
else:
g2= Group([Vec3(Fol(elem.attributes()[dipdir2],elem.attributes()[dip2])) for elem in layer2.getFeatures()],name='schisto')
print g2
#intersection
inters = (g.R ** g2.R)
print inters.aslin.dd
resultat= "intersection: " + str(int(round(inters.aslin.dd[1]))) + " -> " + str(int(round(inters.aslin.dd[0])))
s = StereoNet()
a = s.ax
s.line(g.aslin, 'b.',markersize=18)
s.line(Ortensor(g).eigenlins.data[2],'r.',markersize=18)
s.plane(Ortensor(g).eigenfols.data[2],'r')
s.plane(g2.asfol)
s.line(g2.aslin, 'c.',markersize=18)
s.line(inters.aslin, markersize=20)
a.set_title(resultat, y=1.06, size=14, color='red')
s.show()