# -*- coding: utf-8 -*- """ This module implements some 2D geometric procedures. """ def translation(point, vector): """ Returns the translated point of `point` by using the translation vector `vector`. Parameters ---------- point: (float, float) the point to be translated. vector: (float, float) the translation vector. Returns ------- (float, float) The translated point. """ return NotImplemented def determinant(vector_1, vector_2): """ Returns the determinant of the matrix : | vector1 Vector2 |. Parameters ---------- vector_1: (float, float) the first vector of the determinant (the first column of the determinant) vector_2: (float, float) the second vector of the determinant (the second column of the determinant) Returns ------- float The determinant of the two vectors. """ return NotImplemented def is_on_the_left_of(line_1, point): """ Returns True if the point `point` is on the left of the line `line_1`. Parameters ---------- line_1 : A tuple of two points. Each point is a tuple of x/y-coordinate. A line defined by two points. vector: (float, float) The translation vector. Returns ------- (float, float) The translated point. """ # Hit : You can use the determinant. Indeed, vector_1 is on the left of # vector_2 if determinant(vector_1, vector_2) < 0. return NotImplemented def is_inside_the_polygon(polygon, point): """ Returns True if the point `point` is inside the convex polygon `polygon`. A polygon is defined by a list of points that are the corners of that polygon. The corners of `polygon` is sorted in such a way, when we visit the points of that list we turn around the polygon counterclockwise. So, all pairs of successive points of that list are on the right of all the other points of that list. Parameters ---------- list_of_corners : A list of points. A list of points. Each point is a tuple of x/y-coordinates. point: (float, float) A point. Returns ------- bool A boolean. """ # Hit : you can use the function `is_on_the_left_of`. return NotImplemented def lines_intersection(line_1, line_2): """ Return the intersection of two lines. Parameters ---------- line_1 : A tuple of two points. Each point is a tuple of x/y-coordinates. A line defined by two points. line_2 : A tuple of two points. Each point is a tuple of x/y-coordinates. A line defined by two points. Returns ------- (float, float) The point of intersection of line_1 and line_2. """ return NotImplemented