mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
purge + pep8
This commit is contained in:
1 parent
5dcbc6b4e1
commit
f6e08f203c
5 files changed
+60
-30
No files matched your search
@@ -229,6 +229,18 @@ class PointXYZ(Point, SQLSubModel):
|
||||
s = (a + b + c) / 2
|
||||
return (s*(s-a) * (s-b)*(s-c)) ** 0.5
|
||||
|
||||
def dist_from_seg(self, p1, p2):
|
||||
a2 = pow(PointXYZ.distance(self, p1), 2)
|
||||
b2 = pow(PointXYZ.distance(self, p2), 2)
|
||||
c2 = pow(PointXYZ.distance(p1, p2), 2)
|
||||
if c2 < 0.00000001:
|
||||
# si les deux points sont confondus
|
||||
d = 0.0
|
||||
else:
|
||||
d = np.sqrt(abs(a2 - pow((c2 - b2 + a2) / (2*np.sqrt(c2)), 2)))
|
||||
|
||||
return d
|
||||
|
||||
def copy(self):
|
||||
p = PointXYZ(self.x,
|
||||
self.y,
|
||||
|
||||
Reference in new issue
Block a user