ellipse(
		x,
		y,
		radiusX,
		radiusY,
		rotation,
		startAngle,
		endAngle,
		anticlockwise = false,
	) {
		// based on from https://github.com/karellodewijk/canvas-webgl/blob/master/canvas-webgl.js
		if (startAngle === endAngle) {
			return;
		}
		const fullCircle = anticlockwise
			? Math.abs(startAngle - endAngle) >= TAU
			: Math.abs(endAngle - startAngle) >= TAU;

		//bring angles all in [0, 2*PI] range
		startAngle = startAngle % TAU;
		endAngle = endAngle % TAU;
		if (startAngle < 0) {
			startAngle += TAU;
		}
		if (endAngle < 0) {
			endAngle += TAU;
		}

		if (startAngle >= endAngle) {
			endAngle += TAU;
		}

		let diff = endAngle - startAngle;

		let direction = 1;
		if (anticlockwise) {
			direction = -1;
			diff = TAU - diff;
		}

		if (fullCircle) {
			diff = TAU;
		}

		const length = (diff * radiusX + diff * radiusY) / 2;
		const nr_of_interpolation_points = length / this.arcResolution;
		const dangle = diff / nr_of_interpolation_points;
		const angleStep = dangle * direction;

		let angle = startAngle;
		const cos_rotation = Math.cos(rotation);
		const sin_rotation = Math.sin(rotation);

		this.moveTo(
			x + radiusX * Math.cos(startAngle),
			y + radiusY * Math.sin(startAngle),
		);

		for (let j = 0; j < nr_of_interpolation_points; j++) {
			const _x1 = radiusX * Math.cos(angle);
			const _y1 = radiusY * Math.sin(angle);
			const _x2 = x + _x1 * cos_rotation - _y1 * sin_rotation;
			const _y2 = y + _x1 * sin_rotation + _y1 * cos_rotation;
			this.lineTo(_x2, _y2);
			angle += angleStep;
		}
		// close the ellipse
		this.lineTo(
			x + radiusX * Math.cos(startAngle),
			y + radiusY * Math.sin(startAngle),
		);
		this.isDirty = true;
	}
adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusX and radiusY
starting at startAngle and ending at endAngle going in the given direction by counterclockwise.
@param {number} x - the x-axis (horizontal) coordinate of the ellipse's center.
@param {number} y - the  y-axis (vertical) coordinate of the ellipse's center.
@param {number} radiusX - the ellipse's major-axis radius. Must be non-negative.
@param {number} radiusY - the ellipse's minor-axis radius. Must be non-negative.
@param {number} rotation - the rotation of the ellipse, expressed in radians.
@param {number} startAngle - the angle at which the ellipse starts, measured clockwise from the positive x-axis and expressed in radians.
@param {number} endAngle - the angle at which the ellipse ends, measured clockwise from the positive x-axis and expressed in radians.
@param {boolean} [anticlockwise=false] - an optional boolean value which, if true, draws the ellipse counterclockwise (anticlockwise).