categories: computer science
Welcome,
Below you will find a video with a detailed explanation of the algorithm for checking the position of a point relative to a line. Its operation, time complexity, and usefulness. Below you will also find ready-to-use code that you can copy if needed.
Code:
punkt = [5, 10]
prosta = [2, 4]
def polozenie(punkt, prosta):
if prosta[0] * punkt[0] + prosta[1] > punkt[1]:
return "pod prosta"
elif prosta[0] * punkt[0] + prosta[1] < punkt[1]:
return "nad prosta"
else:
return "na prostej"
print(polozenie(punkt, prosta))
Video:
Thank you for reading!
Read more