ovl.math.geometry module¶
-
ovl.math.geometry.
angle_between_points
(first_point, second_point)[source]¶ Calculates the angle between the 2 points and the horizontal axis :param first_point: the first point (2d) :param second_point: the second point (2d) :return: the angle
-
ovl.math.geometry.
circle_area
(radius)[source]¶ Calculates the area of a circle with the given radius.
Parameters: radius – The radius of the circle Returns: Area of the circle
-
ovl.math.geometry.
contour_angle_line
(contour)[source]¶ Returns the angle of the line created by the top-most and bottom-most points of a contour
Parameters: contour – the contour, a numpy array Returns: the angle in degrees
-
ovl.math.geometry.
distance_between_points
(first_point, second_point)[source]¶ Calculates the Distance between 2 points. (x^2 + y^2) ^ 0.5
Parameters: - first_point – tuple of x and y value of point 1
- second_point – tuple of x and y value of point 2
Returns: Float value of the distance between the 2 points
Return type: float
-
ovl.math.geometry.
law_of_cosine
(first_point, second_point, third_point) → float[source]¶ Finds the angle BAC in degrees given that first_point = A second point = B and third point = C
-
ovl.math.geometry.
polygon_area
(side_length, amount_of_sides)[source]¶ - area of a polygon of
Parameters: - side_length – side_length of a side of the polygon
- amount_of_sides – Amount of sides the polygon has
Returns: the area of the polygon
-
ovl.math.geometry.
regular_polygon_angle
(side_amount: int) → float[source]¶ Returns the inner angle of a polygon with the given amount of sides
Parameters: side_amount – amount of sides the polygon has Returns:
-
ovl.math.geometry.
slope
(first_point, second_point)[source]¶ Returns the slope between 2 points
Parameters: - first_point – first point (x,y)
- second_point – second point (x,y)
Returns: the slope
-
ovl.math.geometry.
x_intersection
(line_slope, intercept, y_value)[source]¶ Calculates the x value of which the line according to the given y value This basically solves y = mx + b
Parameters: - line_slope – slope of the line (m)
- intercept – the intercept of the line (b)
- y_value – the value to be used (substituted with x)
Returns: the y value
-
ovl.math.geometry.
y_intersection
(line_slope, intercept, x_value)[source]¶ Finds the y value of the line (y = mx + b) at point x and returns the point This basically solves y = mx + b
Parameters: - line_slope – slope of the line (m)
- intercept – the intercept of the line (b)
- x_value – the value to be used (substituted with x)
Returns: the y value