triangulatePath() {
		const vertices = this.vertices;

		if (this.isDirty) {
			const points = this.points;
			const indices = earcut(
				points.flatMap((p) => {
					return [p.x, p.y];
				}),
			);
			const indicesLength = indices.length;

			// pre-allocate vertices if necessary
			while (vertices.length < indicesLength) {
				vertices.push(pointPool.get());
			}

			// calculate all vertices
			for (let i = 0; i < indicesLength; i++) {
				const point = points[indices[i]];
				vertices[i].set(point.x, point.y);
			}

			// recycle overhead from a previous triangulation
			while (vertices.length > indicesLength) {
				pointPool.release(vertices[vertices.length - 1]);
				vertices.length -= 1;
			}
			this.isDirty = false;
		}

		return vertices;
	}
triangulate the shape defined by this path into an array of triangles
@returns {Point[]} an array of vertices representing the triangulated path or shape