function generatePattern(id, density) {
const patternVector = document.createElementNS('http://www.w3.org/2000/svg', 'pattern')
patternVector.setAttribute('id', id)
patternVector.setAttribute('patternUnits', 'userSpaceOnUse')
patternVector.setAttribute('patternTransform', 'rotate(-45)')
patternVector.setAttribute('width', 1)
patternVector.setAttribute('height', 2)
const lineVector = document.createElementNS('http://www.w3.org/2000/svg', 'line')
lineVector.setAttribute('x1', 0)
lineVector.setAttribute('x2', '100%')
lineVector.setAttribute('y1', 0)
lineVector.setAttribute('y2', 0)
lineVector.setAttribute ('stroke', 'black')
lineVector.setAttribute('stroke-width', 1)
patternVector.appendChild(lineVector)
return patternVector
}