geometry module¶
2D geometry objects.
- Date
2019-03-21
-
cubic(point1, angle1, point2, angle2, samples=50)[source]¶ - Parameters
point1 (tuple) – one end point
angle1 (int or float) – the slope at the one end point
point2 (tuple) – other end point
angle2 (int or float) – the slope at the other end point
samples (int) – number of sampling points
- Returns
([sample_point1_x, sample_point2_x, …], [sample_points1_y, sample_point2_y, …])
- Return type
tuple
-
cubic_deg(point1, angle1, point2, angle2)[source]¶ - Parameters
point1 (tuple) – one end point
angle1 (int or float) – the slope at the one end point
point2 (tuple) – other end point
angle2 (int or float) – the slope at the other end point
- Returns
([sample_point1_x, sample_point2_x, …], [sample_points1_y, sample_point2_y, …])
- Return type
tuple
See also
-
line(point1, point2, samples=2)[source]¶ - \[y = \frac{y_2-y_1}{x_2-x_1}(x-x_1) + y_1\]
- Parameters
point1 (tuple) – one end point
point2 (tuple) – other end point
samples (int) – number of sampling points
- Returns
((point1_x, point2_x), (points1_y, point2_y)) or ([sample_point1_x, sample_point2_x, …], [sample_points1_y, sample_point2_y, …])
- Return type
tuple
-
points(*pts)[source]¶ - Parameters
*pts – points to rearrange
- Returns
((point1_x, point2_x), (point1_y, point2_y), …)
- Return type
tuple
-
rectangle(width, height)[source]¶ - Parameters
width (int or float) – the width of the rectangle
height (int or float) – the height of the rectangle
- Returns
(point1, point2, point3, point4)
- Return type
tuple
-
rotate(origin, angle, *pts, **kwargs)[source]¶ Rotate a point or polygon counterclockwise by a given angle around a given origin. The angle should be given in radians.
- Parameters
origin (tuple) – the center of rotation
angle (int or float) – the rotation angle
*pts – points to rotate
**kwargs – options
- Returns
(point_x, point_y) or (point1, point2, …)
- Return type
tuple
-
rotate_deg(origin, angle, *pts, **kwargs)[source]¶ Rotate a point or polygon counterclockwise by a given angle around a given origin. The angle should be given in degrees.
- Parameters
origin (tuple) – the center of rotation
angle (int or float) – the rotation angle
*pts – points to rotate
**kwargs – options
- Returns
(point_x, point_y) or (point1, point2, …)
- Return type
tuple
See also