fixup! first commit
This commit is contained in:
parent
9386728e96
commit
a5221b52a5
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
__pycache__/
|
Binary file not shown.
@ -1,3 +1,19 @@
|
||||
def transform_mp_to_abc(m, p):
|
||||
"""transforme une équation de la forme y = mx + p to ax + by = c
|
||||
|
||||
:returns: 3-uple of a, b, c
|
||||
|
||||
"""
|
||||
return -m, 1, p
|
||||
|
||||
def transform_abc_to_mp(a, b, c):
|
||||
"""transforme une équation de la forme to ax + by = c to y = mx + p
|
||||
|
||||
:returns: tuple of m, x
|
||||
|
||||
"""
|
||||
return -a/b, c
|
||||
|
||||
def droite(p1: tuple,p2: tuple) -> tuple:
|
||||
"""retourne un 3-uple d'une droite selon ax+by=c
|
||||
|
||||
@ -64,22 +80,32 @@ def intersection(d1, d2):
|
||||
|
||||
|
||||
def droite_normale(d, p):
|
||||
"""TODO: trouve la normale dune droite passant par un point.
|
||||
"""trouve la normale dune droite passant par un point.
|
||||
|
||||
:d: droite
|
||||
:p: point
|
||||
:returns: retourne la normale de la droite passant par le point
|
||||
|
||||
"""
|
||||
a, b, c = d
|
||||
x, y = p
|
||||
|
||||
m, p = transform_abc_to_mp(a, b, c)
|
||||
return transform_mp_to_abc(-1/m, y-(-1/m)*x)
|
||||
|
||||
|
||||
|
||||
|
||||
def symetrie_orthogonale(d, p):
|
||||
"""TODO: Docstring for symetrie_orthogonale(d, p.
|
||||
:returns: TODO
|
||||
""" retourne la symétrie orthogonale par le point p de la droite d
|
||||
:returns: symétrie orthogonale
|
||||
|
||||
"""
|
||||
pass
|
||||
a, b, c = d
|
||||
x, y = p
|
||||
ap, bp, cp = droite_normale(d,p) # perpendiculaire passant par le point
|
||||
xi, yi = intersection((a,b,c), (ap, bp, cp))
|
||||
return xi, yi
|
||||
|
||||
def distance_droite_point(d, p):
|
||||
"""TODO: Docstring for distance_droite_point.
|
||||
|
Loading…
Reference in New Issue
Block a user