geometry module

2D

@date: 2019-03-21 @author: Daniel Weschke

cubic(point1, angle1, point2, angle2, samples=50)

returns ([sample_point1_x, sample_point2_x, …], [sample_points1_y, sample_point2_y, …])

cubic_deg(point1, angle1, point2, angle2)

returns ([sample_point1_x, sample_point2_x, …], [sample_points1_y, sample_point2_y, …])

line(point1, point2, samples=2)

samples: number of sampling points

y = (y2-y1)/(x2-x1)*(x-x1) + y1

returns

((point1_x, point2_x), (points1_y, point2_y)) or ([sample_point1_x, sample_point2_x, …], [sample_points1_y, sample_point2_y, …])

points(*pts)

returns ((point1_x, point2_x), (point1_y, point2_y), …)

rectangle(width, height)

returns (point1, point2, point3, point4)

rotate(origin, angle, *pts, **kwargs)

Rotate a point or polygon counterclockwise by a given angle around a given origin.

The angle should be given in radians.

returns

(point_x, point_y) or (point1, point2, …)

rotate_deg(origin, angle, *pts, **kwargs)

Rotate a point or polygon counterclockwise by a given angle around a given origin.

The angle should be given in degrees.

returns

(point_x, point_y) or (point1, point2, …)

square(width)

returns (point1, point2, point3, point4)

translate(vec, *pts)

Translate a point or polygon by a given vector.

returns

(point_x, point_y) or (point1, point2, …)