0x9b85…aa34

All memos sent from and to 0x9b85…aa34.

This project opens on November 22nd at 2pm ET/1pm CT and closes on December 1st at 2pm ET/1pm CT. # Yuccas and Boxes One of the things I took away from my summer trip to Marfa was the need to spend more time absorbing my surroundings and thinking back on my experiences. Witnessing the vast fields of yuccas flowering simultaneously and watching the sunrise over Judd's 100 untitled works in mill aluminum are two specific moments that will never leave my memory. Combining these two sensations resulted in generative arrangements of yuccas and boxes. ## Edge of the desert The city of Marfa is on the northeast side of the Chihuahuan desert. The weather is dry and hot in the summer. Plants that grow naturally in the region, like the yucca, have adapted well to the harsh conditions. ## Soaptrees In the Americas, there are a lot of different types of yucca. The type of yucca that grows in and around Marfa is called yucca elata, which is also known as the soaptree yucca. These yuccas grow very slowly, only about an inch per year. Yucca elata doesn't always bloom, but when it does, the flowers come out between May and June. ## Sunrise at Chinati The Chinati Foundation is a museum in Marfa based on Donald Judd's ideas. The focus is on works that have a strong connection to the land around them. Sometimes a special event called "Sunrise at Chinati" is held at the museum so that people can see the many works in the golden light of the morning sun. # An SVG is available! The SVG is a fully scalable resolution agnostic version of the image. To access the SVG press the "p" key and the SVG will automatically download.
# Yuccas and Boxes One of the things I took away from my summer trip to Marfa was the need to spend more time absorbing my surroundings and thinking back on my experiences. Witnessing the vast fields of yuccas flowering simultaneously and watching the sunrise over Judd's 100 untitled works in mill aluminum are two specific moments that will never leave my memory. Combining these two sensations resulted in generative arrangements of yuccas and boxes. ## Edge of the desert The city of Marfa is on the northeast side of the Chihuahuan desert. The weather is dry and hot in the summer. Plants that grow naturally in the region, like the yucca, have adapted well to the harsh conditions. ## Soaptrees In the Americas, there are a lot of different types of yucca. The type of yucca that grows in and around Marfa is called yucca elata, which is also known as the soaptree yucca. These yuccas grow very slowly, only about an inch per year. Yucca elata doesn't always bloom, but when it does, the flowers come out between May and June. ## Sunrise at Chinati The Chinati Foundation is a museum in Marfa based on Donald Judd's ideas. The focus is on works that have a strong connection to the land around them. Sometimes a special event called "Sunrise at Chinati" is held at the museum so that people can see the many works in the golden light of the morning sun. # An SVG is available! The SVG is a fully scalable resolution agnostic version of the image. To access the SVG press the "p" key and the SVG will automatically download.
# Yuccas and Boxes One of the things I took away from my summer trip to Marfa was the need to spend more time absorbing my surroundings and thinking back on my experiences. Witnessing the vast fields of yuccas flowering simultaneously and watching the sunrise over Judd's 100 untitled works in mill aluminum are two specific moments that will never leave my memory. Combining these two sensations resulted in generative arrangements of yuccas and boxes. ## Edge of the desert The city of Marfa is on the northeast side of the Chihuahuan desert. The weather is dry and hot in the summer. Plants that grow naturally in the region, like the yucca, have adapted well to the harsh conditions. ## Soaptrees In the Americas, there are a lot of different types of yucca. The type of yucca that grows in and around Marfa is called yucca elata, which is also known as the soaptree yucca. These yuccas grow very slowly, only about an inch per year. Yucca elata doesn't always bloom, but when it does, the flowers come out between May and June. ## Sunrise at Chinati The Chinati Foundation is a museum in Marfa based on Donald Judd's ideas. The focus is on works that have a strong connection to the land around them. Sometime a special event called "Sunrise at Chinati" is held at the museum so that people can see the many works in the golden light of the morning sun. # An SVG is available! The SVG is a fully scalable resolution agnostic version of the image. To access the SVG press the "p" key and the SVG will automatically download.
function draw(){color(23,100,200);background(cc[0]),drawFlowerPower(),rooms.forEach(t=>{t.drawFill(),stroke(cc[2]),t.drawBack()}),rooms.forEach((t,e,r)=>{yuccas[e].forEach(t=>{t.display()})}),rooms.forEach(t=>{stroke(cc[2]),noFill(),t.drawFront()}),showWords&&drawWords(words)}function createFlowerPower(){if(flowerPower&&1===artistStyle){let t=worldSpaceDims[0]/grid[0]/20;frankeSquares.push(generateFrankeSquares(t)),frankeSquares.push(generateFrankeSquares(2*t)),frankeSquares.push(generateFrankeSquares(4*t))}}function drawFlowerPower(){if(flowerPower&&1===artistStyle){let t=worldSpaceDims[0]/grid[0]/20;strokeWeight(.09*t*globalScaler),drawFrankeSquares(0),drawFrankeSquares(1),drawFrankeSquares(2)}}function generateFrankeSquares(t){let e=[];for(let r=0;r<worldSpaceDims[0];r+=2*t)for(let s=0;s<worldSpaceDims[1];s+=2*t){let o=RR(2*-t,2*t),l=RR(2*-t,2*t);e.push([pv(r+o,s+l),pv(r+t+o,s+l),pv(r+t+o,s+t+l),pv(r+o,s+t+l)])}return e=e.filter(t=>!!(pointInBounds(t[0])&&pointInBounds(t[1])&&pointInBounds(t[2])&&pointInBounds(t[3])))}function pointInBounds(t){return t.x>=.005*worldSpaceDims[1]&&t.x<=worldSpaceDims[0]-.005*worldSpaceDims[1]&&t.y>=.012*worldSpaceDims[1]&&t.y<=worldSpaceDims[1]-.012*worldSpaceDims[1]}function drawFrankeSquares(t){noFill(),stroke(franke[t]),frankeSquares[t].forEach(t=>{beginShape(),prepareColors(),vertex(t[0].x*globalScaler,t[0].y*globalScaler),vertex(t[1].x*globalScaler,t[1].y*globalScaler),vertex(t[2].x*globalScaler,t[2].y*globalScaler),vertex(t[3].x*globalScaler,t[3].y*globalScaler),endShape(CLOSE)})}function createGrid(){let t=[1,1];return R()>.39&&(t=[Math.floor(RR(0,3))+1,Math.floor(RR(0,3))+1],RR(0,1)>.83&&(t=RR(0,1)>.8?[8,8]:[4,Math.floor(RR(4,7))])),t}function createTargetBoxes(t){let e=[],r=.038;flowerPower&&0==artistStyle&&(r=.06);let s=worldSpaceDims[0]*r,o=worldSpaceDims[1]*r,l=worldSpaceDims[0]-2*s,a=worldSpaceDims[1]-2*o;for(let t=0;t<l;t+=l/grid[0])for(let r=0;r<a;r+=a/grid[1])t+l/grid[0]<worldSpaceDims[0]-s&&r+a/grid[1]<worldSpaceDims[1]-o&&e.push(pv(t+s+l/grid[0]/2,.01*-worldSpaceDims[1]+r+o+a/grid[1]/2));let i=e.map(t=>[pv(t.x-(worldSpaceDims[0]-2*s)/grid[0]/2,t.y-(worldSpaceDims[1]-2*o)/grid[1]/2),pv(t.x+(worldSpaceDims[0]-2*s)/grid[0]/2,t.y-(worldSpaceDims[1]-2*o)/grid[1]/2),pv(t.x+(worldSpaceDims[0]-2*s)/grid[0]/2,t.y+(worldSpaceDims[1]-2*o)/grid[1]/2),pv(t.x-(worldSpaceDims[0]-2*s)/grid[0]/2,t.y+(worldSpaceDims[1]-2*o)/grid[1]/2)]),n=Math.floor(RR(0,i.length)),h=getBoxData(i[n]);return grid[0]*grid[1]<6&&(h.width/h.height<.5&&RR(0,1)>.5?(i[n][2].set(i[n][2].x,h.mp.y),i[n][3].set(i[n][3].x,h.mp.y),i.push(i[n].map(t=>pv(t.x,t.y+h.mp.y)))):h.width/h.height>1.5&&RR(0,1)>.5&&(i[n][1].set(h.mp.x,i[n][1].y),i[n][2].set(h.mp.x,i[n][2].y),i.push(i[n].map(t=>pv(t.x+h.mp.x,t.y))))),i=i.map(t=>contour(t,.008*-worldSpaceDims[0]))}function createRooms(){targetBoxes.map(t=>{rooms.push(new Room(t))})}function drawArr(t){beginShape(),t.forEach(t=>{vertex(t.x,t.y)}),endShape(CLOSE)}function prepareYuccas(){for(let t=0;t<rooms.length;t++){yuccas[t]=[];for(let e=0;e<rooms[t].slices.length;e++){let r=Math.floor(abs(RR(0,4)));1==rooms.length&&1==rooms[0].slices.length&&(r=5),yuccas[t].push(new Yucca(r));let s=getBoxData(rooms[t].slices[e]),o=.0012*s.height,l=(s.width-yuccas[t][yuccas[t].length-1].stemBaseWidth*o)*R();yuccas[t][yuccas[t].length-1].moveAndScale(o,pv(0,0),pv(rooms[t].slices[e][0].x+l+yuccas[t][yuccas[t].length-1].stemBaseWidth*o/2,rooms[t].slices[e][2].y))}}}function fitToTargetBox(t,e){let r=pv((t[0].x+t[1].x)/2,(t[1].y+t[2].y)/2),s=[];yuccas[e].forEach(t=>{s.push(t.gatherBBs())}),s.push(rooms[e].gatherBBs());let o=combineBB(s),l=fitScalar([o.p1,o.p2,o.p3,o.p4],0,t);yuccas[e].forEach(t=>{t.moveAndScale(l,o.mp,r)}),rooms[e].moveAndScale(l,o.mp,r)}function keyPressed(){"p"==key&&exportSVG(worldSpaceDims[0],worldSpaceDims[1]),"c"==key&&(showWords=!showWords,draw())}p5.disableFriendlyErrors=!0;
function draw(){color(23,100,200);background(cc[0]),drawFlowerPower(),rooms.forEach(t=>{t.drawFill(),stroke(cc[2]),t.drawBack()}),rooms.forEach((t,e,r)=>{yuccas[e].forEach(t=>{t.display()})}),rooms.forEach(t=>{stroke(cc[2]),noFill(),t.drawFront()}),showWords&&drawWords(words)}function createFlowerPower(){if(flowerPower&&1===artistStyle){let t=worldSpaceDims[0]/grid[0]/20;frankeSquares.push(generateFrankeSquares(t)),frankeSquares.push(generateFrankeSquares(2*t)),frankeSquares.push(generateFrankeSquares(4*t))}}function drawFlowerPower(){if(flowerPower&&1===artistStyle){let t=worldSpaceDims[0]/grid[0]/20;strokeWeight(.09*t*globalScaler),drawFrankeSquares(0),drawFrankeSquares(1),drawFrankeSquares(2)}}function generateFrankeSquares(t){let e=[];for(let r=0;r<worldSpaceDims[0];r+=2*t)for(let s=0;s<worldSpaceDims[1];s+=2*t){let o=RR(2*-t,2*t),l=RR(2*-t,2*t);e.push([pv(r+o,s+l),pv(r+t+o,s+l),pv(r+t+o,s+t+l),pv(r+o,s+t+l)])}return e=e.filter(t=>!!(pointInBounds(t[0])&&pointInBounds(t[1])&&pointInBounds(t[2])&&pointInBounds(t[3])))}function pointInBounds(t){return t.x>=.005*worldSpaceDims[1]&&t.x<=worldSpaceDims[0]-.005*worldSpaceDims[1]&&t.y>=.012*worldSpaceDims[1]&&t.y<=worldSpaceDims[1]-.012*worldSpaceDims[1]}function drawFrankeSquares(t){noFill(),stroke(franke[t]),frankeSquares[t].forEach(t=>{beginShape(),prepareColors(),vertex(t[0].x*globalScaler,t[0].y*globalScaler),vertex(t[1].x*globalScaler,t[1].y*globalScaler),vertex(t[2].x*globalScaler,t[2].y*globalScaler),vertex(t[3].x*globalScaler,t[3].y*globalScaler),endShape(CLOSE)})}function createGrid(){let t=[1,1];return R()>.39&&(t=[Math.floor(RR(0,3))+1,Math.floor(RR(0,3))+1],RR(0,1)>.83&&(t=RR(0,1)>.8?[8,8]:[4,Math.floor(RR(4,7))])),t}function createTargetBoxes(t){let e=[],r=.038;flowerPower&&0==artistStyle&&(r=.06);let s=worldSpaceDims[0]*r,o=worldSpaceDims[1]*r,l=worldSpaceDims[0]-2*s,a=worldSpaceDims[1]-2*o;for(let t=0;t<l;t+=l/grid[0])for(let r=0;r<a;r+=a/grid[1])t+l/grid[0]<worldSpaceDims[0]-s&&r+a/grid[1]<worldSpaceDims[1]-o&&e.push(pv(t+s+l/grid[0]/2,.01*-worldSpaceDims[1]+r+o+a/grid[1]/2));let i=e.map(t=>[pv(t.x-(worldSpaceDims[0]-2*s)/grid[0]/2,t.y-(worldSpaceDims[1]-2*o)/grid[1]/2),pv(t.x+(worldSpaceDims[0]-2*s)/grid[0]/2,t.y-(worldSpaceDims[1]-2*o)/grid[1]/2),pv(t.x+(worldSpaceDims[0]-2*s)/grid[0]/2,t.y+(worldSpaceDims[1]-2*o)/grid[1]/2),pv(t.x-(worldSpaceDims[0]-2*s)/grid[0]/2,t.y+(worldSpaceDims[1]-2*o)/grid[1]/2)]),n=Math.floor(RR(0,i.length)),h=getBoxData(i[n]);return grid[0]*grid[1]>6&&(h.width/h.height<.5&&RR(0,1)>.5?(i[n][2].set(i[n][2].x,h.mp.y),i[n][3].set(i[n][3].x,h.mp.y),i.push(i[n].map(t=>pv(t.x,t.y+h.mp.y)))):h.width/h.height>1.5&&RR(0,1)>.5&&(i[n][1].set(h.mp.x,i[n][1].y),i[n][2].set(h.mp.x,i[n][2].y),i.push(i[n].map(t=>pv(t.x+h.mp.x,t.y))))),i=i.map(t=>contour(t,.008*-worldSpaceDims[0]))}function createRooms(){targetBoxes.map(t=>{rooms.push(new Room(t))})}function drawArr(t){beginShape(),t.forEach(t=>{vertex(t.x,t.y)}),endShape(CLOSE)}function prepareYuccas(){for(let t=0;t<rooms.length;t++){yuccas[t]=[];for(let e=0;e<rooms[t].slices.length;e++){let r=Math.floor(abs(RR(0,4)));1==rooms.length&&1==rooms[0].slices.length&&(r=5),yuccas[t].push(new Yucca(r));let s=getBoxData(rooms[t].slices[e]),o=.0012*s.height,l=(s.width-yuccas[t][yuccas[t].length-1].stemBaseWidth*o)*R();yuccas[t][yuccas[t].length-1].moveAndScale(o,pv(0,0),pv(rooms[t].slices[e][0].x+l+yuccas[t][yuccas[t].length-1].stemBaseWidth*o/2,rooms[t].slices[e][2].y))}}}function fitToTargetBox(t,e){let r=pv((t[0].x+t[1].x)/2,(t[1].y+t[2].y)/2),s=[];yuccas[e].forEach(t=>{s.push(t.gatherBBs())}),s.push(rooms[e].gatherBBs());let o=combineBB(s),l=fitScalar([o.p1,o.p2,o.p3,o.p4],0,t);yuccas[e].forEach(t=>{t.moveAndScale(l,o.mp,r)}),rooms[e].moveAndScale(l,o.mp,r)}function keyPressed(){"p"==key&&exportSVG(worldSpaceDims[0],worldSpaceDims[1]),"c"==key&&(showWords=!showWords,draw())}p5.disableFriendlyErrors=!0;
# Yuccas and Boxes --- One of the things I took away from my summer trip to Marfa was the need to spend more time taking in my surroundings and thinking back on my experiences. Witnessing the vast fields of yuccas flowering simultaneously and watching the sunrise over Judd's 100 untitled works in mill aluminum are two specific moments that will never leave my memory. Combining these two sensations resulted in generative arrangements of yuccas and boxes. * There is an internal SVG exporter for this project. Using the SVG format will maximize your viewing experience. ## While in Live View: * Download your generated output as an SVG file by pressing the "p" key.
function draw(){color(23,100,200);background(cc[0]),drawFlowerPower(),rooms.forEach(t=>{t.drawFill(),stroke(cc[2]),t.drawBack()}),rooms.forEach((t,e,r)=>{yuccas[e].forEach(t=>{t.display()})}),rooms.forEach(t=>{stroke(cc[2]),noFill(),t.drawFront()}),showWords&&drawWords(words)}function createFlowerPower(){if(flowerPower&&1===artistStyle){let t=worldSpaceDims[0]/grid[0]/20;frankeSquares.push(generateFrankeSquares(t)),frankeSquares.push(generateFrankeSquares(2*t)),frankeSquares.push(generateFrankeSquares(4*t))}}function drawFlowerPower(){if(flowerPower&&1===artistStyle){let t=worldSpaceDims[0]/grid[0]/20;strokeWeight(.09*t*globalScaler),drawFrankeSquares(0),drawFrankeSquares(1),drawFrankeSquares(2)}}function generateFrankeSquares(t){let e=[];for(let r=0;r<worldSpaceDims[0];r+=2*t)for(let s=0;s<worldSpaceDims[1];s+=2*t){let o=RR(2*-t,2*t),l=RR(2*-t,2*t);e.push([pv(r+o,s+l),pv(r+t+o,s+l),pv(r+t+o,s+t+l),pv(r+o,s+t+l)])}return e=e.filter(t=>!!(pointInBounds(t[0])&&pointInBounds(t[1])&&pointInBounds(t[2])&&pointInBounds(t[3])))}function pointInBounds(t){return t.x>=.005*worldSpaceDims[1]&&t.x<=worldSpaceDims[0]-.005*worldSpaceDims[1]&&t.y>=.012*worldSpaceDims[1]&&t.y<=worldSpaceDims[1]-.012*worldSpaceDims[1]}function drawFrankeSquares(t){noFill(),stroke(franke[t]),frankeSquares[t].forEach(t=>{beginShape(),prepareColors(),vertex(t[0].x*globalScaler,t[0].y*globalScaler),vertex(t[1].x*globalScaler,t[1].y*globalScaler),vertex(t[2].x*globalScaler,t[2].y*globalScaler),vertex(t[3].x*globalScaler,t[3].y*globalScaler),endShape(CLOSE)})}function createGrid(){let t=[1,1];return R()>.39&&(t=[Math.floor(RR(0,3))+1,Math.floor(RR(0,3))+1],RR(0,1)>.83&&(t=RR(0,1)>.8?[8,8]:[4,Math.floor(RR(4,7))])),t}function createTargetBoxes(t){let e=[],r=.038;flowerPower&&0==artistStyle&&(r=.06);let s=worldSpaceDims[0]*r,o=worldSpaceDims[1]*r,l=worldSpaceDims[0]-2*s,a=worldSpaceDims[1]-2*o;for(let t=0;t<l;t+=l/grid[0])for(let r=0;r<a;r+=a/grid[1])t+l/grid[0]<worldSpaceDims[0]-s&&r+a/grid[1]<worldSpaceDims[1]-o&&e.push(pv(t+s+l/grid[0]/2,.01*-worldSpaceDims[1]+r+o+a/grid[1]/2));let i=e.map(t=>[pv(t.x-(worldSpaceDims[0]-2*s)/grid[0]/2,t.y-(worldSpaceDims[1]-2*o)/grid[1]/2),pv(t.x+(worldSpaceDims[0]-2*s)/grid[0]/2,t.y-(worldSpaceDims[1]-2*o)/grid[1]/2),pv(t.x+(worldSpaceDims[0]-2*s)/grid[0]/2,t.y+(worldSpaceDims[1]-2*o)/grid[1]/2),pv(t.x-(worldSpaceDims[0]-2*s)/grid[0]/2,t.y+(worldSpaceDims[1]-2*o)/grid[1]/2)]),n=Math.floor(RR(0,i.length)),h=getBoxData(i[n]);return h.width/h.height<.5&&RR(0,1)>.5?(i[n][2].set(i[n][2].x,h.mp.y),i[n][3].set(i[n][3].x,h.mp.y),i.push(i[n].map(t=>pv(t.x,t.y+h.mp.y)))):h.width/h.height>1.5&&RR(0,1)>.5&&(i[n][1].set(h.mp.x,i[n][1].y),i[n][2].set(h.mp.x,i[n][2].y),i.push(i[n].map(t=>pv(t.x+h.mp.x,t.y)))),i=i.map(t=>contour(t,.008*-worldSpaceDims[0]))}function createRooms(){targetBoxes.map(t=>{rooms.push(new Room(t))})}function drawArr(t){beginShape(),t.forEach(t=>{vertex(t.x,t.y)}),endShape(CLOSE)}function prepareYuccas(){for(let t=0;t<rooms.length;t++){yuccas[t]=[];for(let e=0;e<rooms[t].slices.length;e++){let r=Math.floor(abs(RR(0,4)));1==rooms.length&&1==rooms[0].slices.length&&(r=5),yuccas[t].push(new Yucca(r));let s=getBoxData(rooms[t].slices[e]),o=.0012*s.height,l=(s.width-yuccas[t][yuccas[t].length-1].stemBaseWidth*o)*R();yuccas[t][yuccas[t].length-1].moveAndScale(o,pv(0,0),pv(rooms[t].slices[e][0].x+l+yuccas[t][yuccas[t].length-1].stemBaseWidth*o/2,rooms[t].slices[e][2].y))}}}function fitToTargetBox(t,e){let r=pv((t[0].x+t[1].x)/2,(t[1].y+t[2].y)/2),s=[];yuccas[e].forEach(t=>{s.push(t.gatherBBs())}),s.push(rooms[e].gatherBBs());let o=combineBB(s),l=fitScalar([o.p1,o.p2,o.p3,o.p4],0,t);yuccas[e].forEach(t=>{t.moveAndScale(l,o.mp,r)}),rooms[e].moveAndScale(l,o.mp,r)}function keyPressed(){"p"==key&&exportSVG(worldSpaceDims[0],worldSpaceDims[1]),"c"==key&&(showWords=!showWords,draw())}p5.disableFriendlyErrors=!0;
class Room{constructor(t){this.boxFront=this.makeFrontOfBox(t),this.boxBack=this.makeBackOfBox(),this.slices=this.makeSlices(),this.flowerPowerPts=this.makeFlowerPowerPts()}makeFrontOfBox(t){return t}makeBackOfBox(){let t=getBoxData(this.boxFront);return this.offset=[RR(-t.width/2,t.width/2),RR(0,-t.height/2)],[pv(this.boxFront[0].x+this.offset[0],this.boxFront[0].y+this.offset[1]),pv(this.boxFront[1].x+this.offset[0],this.boxFront[1].y+this.offset[1]),pv(this.boxFront[2].x+this.offset[0],this.boxFront[2].y+this.offset[1]),pv(this.boxFront[3].x+this.offset[0],this.boxFront[3].y+this.offset[1])]}makeSlices(){let t=[],e=[.1,.5,.9];for(let r=Math.floor(RR(0,3));r<e.length;r++){let s=pv(lerp(this.boxBack[0].x,this.boxFront[0].x,e[r]),lerp(this.boxBack[0].y,this.boxFront[0].y,e[r])),o=pv(lerp(this.boxBack[1].x,this.boxFront[1].x,e[r]),lerp(this.boxBack[1].y,this.boxFront[1].y,e[r])),l=pv(lerp(this.boxBack[2].x,this.boxFront[2].x,e[r]),lerp(this.boxBack[2].y,this.boxFront[2].y,e[r])),a=pv(lerp(this.boxBack[3].x,this.boxFront[3].x,e[r]),lerp(this.boxBack[3].y,this.boxFront[3].y,e[r]));t.push([s,o,l,a])}return t}makeFlowerPowerPts(){if(flowerPower&&0==artistStyle){let t=[],e=[],r=(this.boxFront[1].x-this.boxFront[0].x)/10;return this.boxBack.forEach((e,s,o)=>{t.push([pv(o[s].x+RR(-r,r),o[s].y+RR(-r,r)),pv(o[(s+1)%o.length].x+RR(-r,r),o[(s+1)%o.length].y+RR(-r,r))])}),t.push([pv(this.boxBack[2].x,this.boxBack[2].y),pv(this.boxFront[2].x,this.boxFront[2].y)]),t.push([pv(this.boxBack[3].x,this.boxBack[3].y),pv(this.boxFront[3].x,this.boxFront[3].y)]),this.offset[0]>0?t.push([pv(this.boxBack[0].x,this.boxBack[0].y),pv(this.boxFront[0].x,this.boxFront[0].y)]):t.push([pv(this.boxBack[1].x,this.boxBack[1].y),pv(this.boxFront[1].x,this.boxFront[1].y)]),this.boxFront.forEach((t,s,o)=>{e.push([pv(o[s].x+RR(-r,r),o[s].y+RR(-r,r)),pv(o[(s+1)%o.length].x+RR(-r,r),o[(s+1)%o.length].y+RR(-r,r))])}),this.offset[0]<=0?e.push([pv(this.boxBack[0].x,this.boxBack[0].y),pv(this.boxFront[0].x,this.boxFront[0].y)]):e.push([pv(this.boxBack[1].x,this.boxBack[1].y),pv(this.boxFront[1].x,this.boxFront[1].y)]),[t,e]}return[]}drawFront(){strokeCap(PROJECT),strokeWeight(this.strokeBase*globalScaler),flowerPower&&0===artistStyle?this.flowerPowerPts[1].forEach(t=>{line(t[0].x*globalScaler,t[0].y*globalScaler,t[1].x*globalScaler,t[1].y*globalScaler)}):(this.boxFront.forEach((t,e,r)=>{line(r[e].x*globalScaler,r[e].y*globalScaler,r[(e+1)%r.length].x*globalScaler,r[(e+1)%r.length].y*globalScaler)}),strokeCap(ROUND),this.offset[0]<=0?line(this.boxBack[0].x*globalScaler,this.boxBack[0].y*globalScaler,this.boxFront[0].x*globalScaler,this.boxFront[0].y*globalScaler):line(this.boxBack[1].x*globalScaler,this.boxBack[1].y*globalScaler,this.boxFront[1].x*globalScaler,this.boxFront[1].y*globalScaler)),strokeCap(PROJECT)}drawBack(){strokeCap(PROJECT),strokeWeight(this.strokeBase*globalScaler),flowerPower&&0===artistStyle?this.flowerPowerPts[0].forEach(t=>{line(t[0].x*globalScaler,t[0].y*globalScaler,t[1].x*globalScaler,t[1].y*globalScaler)}):(this.boxBack.forEach((t,e,r)=>{line(r[e].x*globalScaler,r[e].y*globalScaler,r[(e+1)%r.length].x*globalScaler,r[(e+1)%r.length].y*globalScaler)}),strokeCap(ROUND),line(this.boxBack[2].x*globalScaler,this.boxBack[2].y*globalScaler,this.boxFront[2].x*globalScaler,this.boxFront[2].y*globalScaler),line(this.boxBack[3].x*globalScaler,this.boxBack[3].y*globalScaler,this.boxFront[3].x*globalScaler,this.boxFront[3].y*globalScaler),this.offset[0]>0?line(this.boxBack[0].x*globalScaler,this.boxBack[0].y*globalScaler,this.boxFront[0].x*globalScaler,this.boxFront[0].y*globalScaler):line(this.boxBack[1].x*globalScaler,this.boxBack[1].y*globalScaler,this.boxFront[1].x*globalScaler,this.boxFront[1].y*globalScaler)),strokeCap(PROJECT)}makeFillPoints(){let t=[];return this.boxFront[0].x<this.boxBack[0].x?(t.push(this.boxBack[0]),t.push(this.boxBack[1]),t.push(this.boxBack[2]),t.push(this.boxFront[2]),t.push(this.boxFront[3]),t.push(this.boxFront[0])):(t.push(this.boxBack[3]),t.push(this.boxBack[0]),t.push(this.boxBack[1]),t.push(this.boxFront[1]),t.push(this.boxFront[2]),t.push(this.boxFront[3])),t}drawFill(){let t=this.makeFillPoints();fill(cc[3]),noStroke(),beginShape(),t.forEach(t=>{vertex(t.x*globalScaler,t.y*globalScaler)}),endShape(CLOSE)}gatherBBs(){return combineBB([boxToBB(this.boxFront),boxToBB(this.boxBack)])}moveAndScale(t,e=pv(0,0),r=pv(0,0)){translateArrDepth1(this.boxFront,e,r),scaleArr(this.boxFront,t,r),translateArrDepth1(this.boxBack,e,r),scaleArr(this.boxBack,t,r),this.flowerPowerPts.forEach(s=>{translateArrDepth2(s,e,r),scaleArrDouble(s,t,r)}),this.slices.map(s=>{translateArrDepth1(s,e,r),scaleArr(s,t,r)});let s=getBoxData(this.boxFront);this.strokeBase=min(s.width,s.height)/200*2.4}}let coords=[[0,0],[50,0],[100,0],[0,50],[50,50],[100,50],[0,100],[50,100],[100,100]],arcPoints=[[50,25],[50,50],[50,75]];function interpretLetter(t){t+="m";let e=[],r=[];for(let s=0;s<t.length;s++)"c"!=t[s]?"m"!=t[s]?r.push(pv(coords[t[s]][0],coords[t[s]][1])):(e.push(r),r=[]):(r.push(...microArch(arcPoints[t[s+1]],coords[t[s+2]],t[s+3])),s+=3);return e}function word(t,e,r,s=.12){let o=[];t=t.toLowerCase();let l=40*s;for(let a=0;a<t.length;a++){let i=interpretLetter(alphabet[t[a]]);scaleArrDouble(i,s,pv(0,100)),translateArrDepth2(i,pv(0,0),pv(e+a*(100*s)+a*l,r)),o.push(i)}return o}function microArch(t,e,r){let s=dist(t[0],t[1],e[0],e[1]);return Array(180).fill().map((e,o)=>pv(t[0]+sin(radians(o+90*r))*s,t[1]+cos(radians(o+90*r))*s))}let alphabet={a:"85c15136m53",b:"06c270c0400m43",c:"2c1128",d:"06c1700",e:"2068m34",f:"206m35",g:"2c112854",h:"06m35m28",i:"02m17m68",j:"c13321",k:"06m238",l:"068",m:"60728",n:"6082",o:"c112c170",p:"3c04006",q:"c112c170m48",r:"3c04006m48",s:"2c012m6c270",t:"02m17",u:"0c1332",v:"072",w:"06482",x:"08m26",y:"047m42",z:"0268",0:"c112c170",1:"017m68",2:"c0400mc2428",3:"6c270c0400",4:"035m17",5:"6c270302",6:"236853",7:"026m35",8:"c040c012mc270c242",9:"652035"," ":""};function prepareWords(){let t=[];return t.push(word("art blocks",20,worldSpaceDims[1]-105)),t.push(word("Daniel Calderon arenas",.25*worldSpaceDims[0]-135,worldSpaceDims[1]-105)),t.push(word("marfa yucca",.5*worldSpaceDims[0]-92,worldSpaceDims[1]-105)),t.push(word("2022",.75*worldSpaceDims[0]-142,worldSpaceDims[1]-105)),t.push(word("generative edition",worldSpaceDims[0]-315,worldSpaceDims[1]-105)),t}function drawWords(t){t.forEach(t=>{t.forEach(t=>{t.forEach(t=>{drawWord(t)})})})}function drawWord(t){strokeCap(ROUND),strokeJoin(ROUND),noFill(),stroke(textColor),strokeWeight(2*globalScaler),beginShape(),t.forEach(t=>{vertex(t.x*globalScaler,t.y*globalScaler)}),endShape()}let grid=createGrid(),showWords=!1;function setup(){scaleAgnosticCanvas(),targetBoxes=createTargetBoxes(),createRooms(),prepareYuccas(),prepareColors(),words=prepareWords(),rooms.forEach((t,e,r)=>{fitToTargetBox(targetBoxes[e],e)}),createFlowerPower(),noLoop()}
class Room{constructor(t){this.boxFront=this.makeFrontOfBox(t),this.boxBack=this.makeBackOfBox(),this.slices=this.makeSlices(),this.flowerPowerPts=this.makeFlowerPowerPts()}makeFrontOfBox(t){return t}makeBackOfBox(){let t=getBoxData(this.boxFront);return this.offset=[RR(-t.width/2,t.width/2),RR(0,-t.height/2)],[pv(this.boxFront[0].x+this.offset[0],this.boxFront[0].y+this.offset[1]),pv(this.boxFront[1].x+this.offset[0],this.boxFront[1].y+this.offset[1]),pv(this.boxFront[2].x+this.offset[0],this.boxFront[2].y+this.offset[1]),pv(this.boxFront[3].x+this.offset[0],this.boxFront[3].y+this.offset[1])]}makeSlices(){let t=[],e=[.1,.5,.9];for(let r=Math.floor(RR(0,3));r<e.length;r++){let s=pv(lerp(this.boxBack[0].x,this.boxFront[0].x,e[r]),lerp(this.boxBack[0].y,this.boxFront[0].y,e[r])),o=pv(lerp(this.boxBack[1].x,this.boxFront[1].x,e[r]),lerp(this.boxBack[1].y,this.boxFront[1].y,e[r])),l=pv(lerp(this.boxBack[2].x,this.boxFront[2].x,e[r]),lerp(this.boxBack[2].y,this.boxFront[2].y,e[r])),a=pv(lerp(this.boxBack[3].x,this.boxFront[3].x,e[r]),lerp(this.boxBack[3].y,this.boxFront[3].y,e[r]));t.push([s,o,l,a])}return t}makeFlowerPowerPts(){if(flowerPower&&0==artistStyle){let t=[],e=[],r=(this.boxFront[1].x-this.boxFront[0].x)/10;return this.boxBack.forEach((e,s,o)=>{t.push([pv(o[s].x+RR(-r,r),o[s].y+RR(-r,r)),pv(o[(s+1)%o.length].x+RR(-r,r),o[(s+1)%o.length].y+RR(-r,r))])}),t.push([pv(this.boxBack[2].x,this.boxBack[2].y),pv(this.boxFront[2].x,this.boxFront[2].y)]),t.push([pv(this.boxBack[3].x,this.boxBack[3].y),pv(this.boxFront[3].x,this.boxFront[3].y)]),this.offset[0]>0?t.push([pv(this.boxBack[0].x,this.boxBack[0].y),pv(this.boxFront[0].x,this.boxFront[0].y)]):t.push([pv(this.boxBack[1].x,this.boxBack[1].y),pv(this.boxFront[1].x,this.boxFront[1].y)]),this.boxFront.forEach((t,s,o)=>{e.push([pv(o[s].x+RR(-r,r),o[s].y+RR(-r,r)),pv(o[(s+1)%o.length].x+RR(-r,r),o[(s+1)%o.length].y+RR(-r,r))])}),this.offset[0]<=0?e.push([pv(this.boxBack[0].x,this.boxBack[0].y),pv(this.boxFront[0].x,this.boxFront[0].y)]):e.push([pv(this.boxBack[1].x,this.boxBack[1].y),pv(this.boxFront[1].x,this.boxFront[1].y)]),[t,e]}return[]}drawFront(){strokeCap(PROJECT),strokeWeight(this.strokeBase*globalScaler),flowerPower&&0===artistStyle?this.flowerPowerPts[1].forEach(t=>{line(t[0].x*globalScaler,t[0].y*globalScaler,t[1].x*globalScaler,t[1].y*globalScaler)}):(this.boxFront.forEach((t,e,r)=>{line(r[e].x*globalScaler,r[e].y*globalScaler,r[(e+1)%r.length].x*globalScaler,r[(e+1)%r.length].y*globalScaler)}),strokeCap(ROUND),this.offset[0]<=0?line(this.boxBack[0].x*globalScaler,this.boxBack[0].y*globalScaler,this.boxFront[0].x*globalScaler,this.boxFront[0].y*globalScaler):line(this.boxBack[1].x*globalScaler,this.boxBack[1].y*globalScaler,this.boxFront[1].x*globalScaler,this.boxFront[1].y*globalScaler)),strokeCap(PROJECT)}drawBack(){strokeCap(PROJECT),strokeWeight(this.strokeBase*globalScaler),flowerPower&&0===artistStyle?this.flowerPowerPts[0].forEach(t=>{line(t[0].x*globalScaler,t[0].y*globalScaler,t[1].x*globalScaler,t[1].y*globalScaler)}):(this.boxBack.forEach((t,e,r)=>{line(r[e].x*globalScaler,r[e].y*globalScaler,r[(e+1)%r.length].x*globalScaler,r[(e+1)%r.length].y*globalScaler)}),strokeCap(ROUND),line(this.boxBack[2].x*globalScaler,this.boxBack[2].y*globalScaler,this.boxFront[2].x*globalScaler,this.boxFront[2].y*globalScaler),line(this.boxBack[3].x*globalScaler,this.boxBack[3].y*globalScaler,this.boxFront[3].x*globalScaler,this.boxFront[3].y*globalScaler),this.offset[0]>0?line(this.boxBack[0].x*globalScaler,this.boxBack[0].y*globalScaler,this.boxFront[0].x*globalScaler,this.boxFront[0].y*globalScaler):line(this.boxBack[1].x*globalScaler,this.boxBack[1].y*globalScaler,this.boxFront[1].x*globalScaler,this.boxFront[1].y*globalScaler)),strokeCap(PROJECT)}makeFillPoints(){let t=[];return this.boxFront[0].x<this.boxBack[0].x?(t.push(this.boxBack[0]),t.push(this.boxBack[1]),t.push(this.boxBack[2]),t.push(this.boxFront[2]),t.push(this.boxFront[3]),t.push(this.boxFront[0])):(t.push(this.boxBack[3]),t.push(this.boxBack[0]),t.push(this.boxBack[1]),t.push(this.boxFront[1]),t.push(this.boxFront[2]),t.push(this.boxFront[3])),t}drawFill(){let t=this.makeFillPoints();fill(cc[3]),noStroke(),beginShape(),t.forEach(t=>{vertex(t.x*globalScaler,t.y*globalScaler)}),endShape(CLOSE)}gatherBBs(){return combineBB([boxToBB(this.boxFront),boxToBB(this.boxBack)])}moveAndScale(t,e=pv(0,0),r=pv(0,0)){translateArrDepth1(this.boxFront,e,r),scaleArr(this.boxFront,t,r),translateArrDepth1(this.boxBack,e,r),scaleArr(this.boxBack,t,r),this.flowerPowerPts.forEach(s=>{translateArrDepth2(s,e,r),scaleArrDouble(s,t,r)}),this.slices.map(s=>{translateArrDepth1(s,e,r),scaleArr(s,t,r)});let s=getBoxData(this.boxFront);this.strokeBase=min(s.width,s.height)/200*2.4}}let coords=[[0,0],[50,0],[100,0],[0,50],[50,50],[100,50],[0,100],[50,100],[100,100]],arcPoints=[[50,25],[50,50],[50,75]];function interpretLetter(t){t+="m";let e=[],r=[];for(let s=0;s<t.length;s++)"c"!=t[s]?"m"!=t[s]?r.push(pv(coords[t[s]][0],coords[t[s]][1])):(e.push(r),r=[]):(r.push(...microArch(arcPoints[t[s+1]],coords[t[s+2]],t[s+3])),s+=3);return e}function word(t,e,r,s=.12){let o=[];t=t.toLowerCase();let l=40*s;for(let a=0;a<t.length;a++){let i=interpretLetter(alphabet[t[a]]);scaleArrDouble(i,s,pv(0,100)),translateArrDepth2(i,pv(0,0),pv(e+a*(100*s)+a*l,r)),o.push(i)}return o}function microArch(t,e,r){let s=dist(t[0],t[1],e[0],e[1]);return Array(180).fill().map((e,o)=>pv(t[0]+sin(radians(o+90*r))*s,t[1]+cos(radians(o+90*r))*s))}let alphabet={a:"85c15136m53",b:"06c270c0400m43",c:"2c1128",d:"06c1700",e:"2068m34",f:"206m35",g:"2c112854",h:"06m35m28",i:"02m17m68",j:"c13321",k:"06m238",l:"068",m:"60728",n:"6082",o:"c112c170",p:"3c04006",q:"c112c170m48",r:"3c04006m48",s:"2c012m6c270",t:"02m17",u:"0c1332",v:"072",w:"06482",x:"08m26",y:"047m42",z:"0268",0:"c112c170",1:"017m68",2:"c0400mc2428",3:"6c270c0400",4:"035m17",5:"6c270302",6:"236853",7:"026m35",8:"c040c012mc270c242",9:"652035"," ":""};function prepareWords(){let t=[];return t.push(word("art blocks",20,worldSpaceDims[1]-105)),t.push(word("Daniel Calderon arenas",.25*worldSpaceDims[0]-135,worldSpaceDims[1]-105)),t.push(word("marfa yucca",.5*worldSpaceDims[0]-92,worldSpaceDims[1]-105)),t.push(word("2022",.75*worldSpaceDims[0]-142,worldSpaceDims[1]-105)),t.push(word("generative edition",worldSpaceDims[0]-315,worldSpaceDims[1]-105)),t}function drawWords(t){t.forEach(t=>{t.forEach(t=>{t.forEach(t=>{drawWord(t)})})})}function drawWord(t){strokeCap(ROUND),strokeJoin(ROUND),noFill(),stroke(textColor),strokeWeight(2*globalScaler),beginShape(),t.forEach(t=>{vertex(t.x*globalScaler,t.y*globalScaler)}),endShape()}let grid=createGrid(),showWords=!1;function setup(){scaleAgnosticCanvas(),targetBoxes=createTargetBoxes(),createRooms(),prepareYuccas(),prepareColors(),words=prepareWords(),rooms.forEach((t,e,r)=>{fitToTargetBox(targetBoxes[e],e)}),createFlowerPower(),noLoop()}
class Yucca{constructor(t){this.pos=pv(0,0),this.stemCount=t,this.stems=[],this.stems.push(this.makeStemPts(this.pos.x,this.pos.y));for(let t=0;t<this.stemCount;t++)this.stems.push(this.makeStemPts(this.stems[0][this.stems[0].length-1].x,this.stems[0][this.stems[0].length-1].y));if(this.stems.length>2){let t=[];this.stems[0].pop(),this.stems[this.stems.length-1].shift(),t.push(...this.stems[0]),t.push(...this.stems[this.stems.length-1]),this.stems[0]=t,this.stems.pop()}this.stemThickness=RR(28,34.5),this.stemsInflated=this.inflateStems(),this.stemBaseWidth=dist(this.stemsInflated[0][0].x,this.stemsInflated[0][0].y,this.stemsInflated[0][this.stemsInflated[0].length-1].x,this.stemsInflated[0][this.stemsInflated[0].length-1].y),this.shag=this.phylloshag(),this.crowns=this.placeCrowns(),this.crowns=this.inflateCrowns(),this.spears=this.makeSpears(),this.spearsInflated=this.inflateSpears(),this.flowers=this.makeFlowersFollow(),this.addAdditionalFlowerStems(),this.flowerBuds=[]}display(){for(let t=this.stemsInflated.length-1;t>=0;t--)this.drawShaggyStem(t),this.drawSpear(t),this.drawFlower(t),this.drawCrown(t)}drawShaggyStem(t){fill(cc[0]),noStroke(),beginShape(),natural&&fill(yc[0]);for(let e=0;e<this.stemsInflated[t].length;e++)vertex(this.stemsInflated[t][e].x*globalScaler,this.stemsInflated[t][e].y*globalScaler);endShape(CLOSE),stroke(cc[1]),strokeWeight(.0025*this.strokeBase*globalScaler),natural&&stroke(yc[1]);for(let e=0;e<this.shag[t].length;e++){let r=color(yc[7]),s=color(yc[1]),o=lerpColor(s,r,map(this.shag[t].length-e,this.shag[t].length/2.73,0,0,1));e%2!=0&&natural?stroke(o):natural&&stroke(yc[1]),line(this.shag[t][e][0].x*globalScaler,this.shag[t][e][0].y*globalScaler,this.shag[t][e][1].x*globalScaler,this.shag[t][e][1].y*globalScaler)}strokeWeight(.002*this.strokeBase*globalScaler)}drawSpear(t){stroke(cc[0]),fill(cc[1]),natural&&(stroke(yc[3]),fill(yc[2])),beginShape();for(let e=0;e<this.spearsInflated[t].length-1;e++)vertex(this.spearsInflated[t][e].x*globalScaler,this.spearsInflated[t][e].y*globalScaler);endShape()}drawFlower(t){for(let e=0;e<this.flowers[t].length;e++)stroke(cc[1]),natural&&stroke(yc[3]),line(this.flowers[t][e][0].x*globalScaler,this.flowers[t][e][0].y*globalScaler,this.flowers[t][e][1].x*globalScaler,this.flowers[t][e][1].y*globalScaler),noStroke(),fill(cc[1]),natural&&fill(yc[4]),ellipse(this.flowers[t][e][1].x*globalScaler,this.flowers[t][e][1].y*globalScaler,this.stemBaseWidth/14*globalScaler)}drawCrown(t){for(let e=0;e<this.crowns[t].length;e+=1)for(let r=0;r<this.crowns[t][e].length;r++){fill(cc[1]),stroke(cc[0]),natural&&(fill(yc[5]),stroke(yc[6])),beginShape();for(let s=0;s<this.crowns[t][e][r].length;s++)vertex(this.crowns[t][e][r][s].x*globalScaler,this.crowns[t][e][r][s].y*globalScaler);endShape()}}gatherBBs(){let t=[];for(let e=0;e<this.stems.length;e++){t.push(getBB(this.stems[e])),t.push(getBB(this.stemsInflated[e])),t.push(getBBdepth2(this.shag[e])),t.push(getBB(this.spears[e])),t.push(getBB(this.spearsInflated[e])),t.push(getBBdepth2(this.flowers[e]));for(let r=0;r<this.crowns[e].length;r++)t.push(getBBdepth2(this.crowns[e][r]))}return combineBB(t)}scaleToThisBB(t){return this.gatherBBs()}moveAndScale(t,e=pv(0,0),r=pv(0,0)){for(let s=0;s<this.stems.length;s++){translateArrDepth1(this.stems[s],e,r),scaleArr(this.stems[s],t,r),translateArrDepth1(this.stemsInflated[s],e,r),scaleArr(this.stemsInflated[s],t,r),translateArrDepth2(this.shag[s],e,r),scaleArrDouble(this.shag[s],t,r),translateArrDepth1(this.spears[s],e,r),scaleArr(this.spears[s],t,r),translateArrDepth1(this.spearsInflated[s],e,r),scaleArr(this.spearsInflated[s],t,r),translateArrDepth2(this.flowers[s],e,r),scaleArrDouble(this.flowers[s],t,r);for(let o=0;o<this.crowns[s].length;o++)translateArrDepth2(this.crowns[s][o],e,r),scaleArrDouble(this.crowns[s][o],t,r)}this.strokeBase=this.gatherBBs().width,this.stemBaseWidth=dist(this.stemsInflated[0][0].x,this.stemsInflated[0][0].y,this.stemsInflated[0][this.stemsInflated[0].length-1].x,this.stemsInflated[0][this.stemsInflated[0].length-1].y)}makeStemPts(t,e){let r=[];0==this.stems.length?(r=[pv(t,e),pointFrom(pv(t,e),180,10)]).push(pointFrom(r[1],180,RR(5,10))):(r=[pv(t,e),pointFrom(pv(t,e),pointDir(this.stems[0][this.stems[0].length-2],this.stems[0][this.stems[0].length-1])+90,10)]).push(pointFrom(r[1],pointDir(r[0],r[1])+90,RR(5,10)));let s=RR(1,10);0==this.stems.length&&(s=RR(1,10));for(let t=0;t<s;t++){let t=pointDir(r[r.length-2],r[r.length-1])-90;r.push(pointFrom(r[r.length-1],t,RR(5,10)))}let o=RR(-6,6);s=RR(10,20),0==this.stems.length&&(s=RR(5,7),o=RR(-o,o));for(let t=0;t<s;t++){let t=pointDir(r[r.length-2],r[r.length-1])-90;t<-250&&(t=-250),t>-120&&(t=-120),t+=o,r.push(pointFrom(r[r.length-1],t,RR(5,10)))}s=0==this.stems.length?RR(1,1):RR(5,41);for(let t=0;t<s;t++){let t=pointDir(r[r.length-2],r[r.length-1])-90;t+180<0&&(t+=1),t+180>0&&(t-=1),t+=RR(-5,5),r.push(pointFrom(r[r.length-1],t,RR(5,10)))}for(let t=0;t<10;t++)soften(r);return r}inflateStems(){let t=[];for(let e=0;e<this.stems.length;e++)0==e?t.push(inflate(this.stems[e],this.stemThickness,RR(1,1.5),1)):t.push(inflate(this.stems[e],this.stemThickness,1,RR(.5,1)));return t}phyllotaxis(t,e,r=100,s=10,o=20,l=[0,0,0,0],a=1){let i=[],n=RR(0,20),h=[RR(.5,1.5),RR(.5,1.5)],c=RR(0,50);for(let p=0,g=0;p<360*r;p+=137.5,g+=1){let u=RR(-n,n),f=RR(-n,n),x=map(g,0,360,h[0],h[1]),d=createVector(t+sin(radians(p))*(sin(radians(map(g+l[0]*a,0,360*r/137.5+l[0]*a,0,180)))*s),e+cos(radians(map(g+l[1]*a,0,360*r/137.5+l[1]*a,c,180)))*s),m=createVector(t+sin(radians(p))*(sin(radians(map(g+l[2]*a,0,360*r/137.5+l[2]*a,0,180)))*(o*x)+u),e+cos(radians(map(g+l[3]*a,0,360*r/137.5+l[3]*a,c,180)))*(o*x)+f);i.push([d,m])}return i.sort(function(r,s){return dist(s[1].x,s[1].y,t,e-60)-dist(r[1].x,r[1].y,t,e-60)}),i}placeCrowns(){let t=[];for(let e=0;e<this.stems.length;e++){let r=RR(1,15);this.stems.length>1&&(r=RR(1,15)),0==e&&this.stems[0].length<50&&(r=RR(30,50)),t.push(this.phyllotaxis(this.stems[e][this.stems[e].length-1].x,this.stems[e][this.stems[e].length-1].y,RR(20,60),0,2*this.stemBaseWidth,[r,r,r,r],1))}return t}inflateCrowns(){let t=[];for(let e=0;e<this.crowns.length;e++){let r=[];for(let t=0;t<this.crowns[e].length;t++){let s=[];s.push(inflate(this.crowns[e][t],5,1,0)),r.push(s)}t.push(r)}return t}makeSpears(){let t=[];for(let e=0;e<this.stems.length;e++){let r=[];r.push(this.stems[e][this.stems[e].length-1]),r.push(pointFrom(r[0],180,10));let s=RR(30,30);for(let t=0;t<s;t++){let t=pointDir(r[r.length-2],r[r.length-1])-90;r.push(pointFrom(r[r.length-1],t,10))}let o=RR(-2.5,2.5);for(let t=0;t<s;t++){let t=pointDir(r[r.length-1],r[r.length-2])+90;t<0&&(t+=360),(t<5||t>355)&&(t=0,o=0),t+=o,r.push(pointFrom(r[r.length-1],t,6))}for(let t=0;t<10;t++)soften(r);t.push(r)}return t}inflateSpears(){let t=[];for(let e=0;e<this.spears.length;e++){let r=inflate(this.spears[e],7,RR(.6,1.2),.1);for(let t=0;t<1;t++)soften(r);t.push(r)}for(let e=this.crowns.length-1;e>=0;e--)for(let r=this.crowns[e].length-1;r>=0;r--)if(pointInsideShape(this.crowns[e][r][0][1],t[e])){this.crowns[e].splice(r,1)}return t}phylloshag(){let t=[];for(let e=0;e<this.stems.length;e++){let r=[],s=0;for(let t=0;t<this.stems[e].length-1;t++){let o=pointDir(this.stems[e][t],this.stems[e][t+1]),l=dist(this.stems[e][t].x,this.stems[e][t].y,this.stemsInflated[e][t].x,this.stemsInflated[e][t].y),a=RR(0,360);for(let i=0;i<1;i+=.03){let n=pv(lerp(this.stems[e][t].x,this.stems[e][t+1].x,i),lerp(this.stems[e][t].y,this.stems[e][t+1].y,i)),h=map(i,0,1,0+a,360+a),c=map(t,s,this.stems[e].length,10,20);0==e&&this.stems.length>1&&(c=10);let p=map(t,s,this.stems[e].length,1,2);0==e&&this.stems.length>1&&(p=map(t,s,this.stems[e].length,1,1));let g=pv(sin(radians(137.5*h))*sin(radians(h))*l,-c),u=pv(sin(radians(137.5*h))*sin(radians(h))*(l*p*RR(1,1.3)),1);rotatePoint(u,pv(0,0),radians(o+90)),rotatePoint(g,pv(0,0),radians(o+90));let f=pointFrom(n,o,0);u.add(n.x,n.y),g.add(f.x,f.y),r.push([g,u])}}t.push(r)}return t}makeFlowersFollow(){let t=[];for(let e=0;e<this.spears.length;e++){let r=[],s=RR(.3,.8),o=60,l=Math.floor(RR(0,360)),a=RR(0,10),i=RR(20,35),n=RR(40,90);for(let t=this.spears[e].length-Math.floor(this.spears[e].length*s);t<this.spears[e].length-(1+a);t++){let a=pointDir(this.spears[e][t],this.spears[e][t+1])-90-180,h=map(t,this.spears[e].length-Math.floor(this.spears[e].length*s),this.spears[e].length-1,0,180);n+=RR(-5,5);let c=pv(sin(radians(137.5*t+l))*sin(radians(h))*n,-i);rotatePoint(c,pv(0,0),radians(a)),c.add(this.spears[e][t].x,this.spears[e][t].y),r.push([this.spears[e][t],c]),(o-=4)<0&&(o=0)}t.push(r)}return t}addAdditionalFlowerStems(){for(let t=0;t<this.spears.length;t++){let e=[];for(let r=0;r<this.flowers[t].length;r++){let s=pointDir(this.flowers[t][r][0],this.flowers[t][r][1]),o=dist(this.flowers[t][r][0].x,this.flowers[t][r][0].y,this.flowers[t][r][1].x,this.flowers[t][r][1].y);for(let l=RR(.3,.5);l<1;l+=5/o){let o=pv(lerp(this.flowers[t][r][0].x,this.flowers[t][r][1].x,l),lerp(this.flowers[t][r][0].y,this.flowers[t][r][1].y,l)),a=pointFrom(o,s-map(l,.5,1,20,60),map(l,0,1,1,RR(5,20)));e.push([o,a]),a=pointFrom(o,s+180+map(l,.5,1,20,60),map(l,0,1,1,RR(5,20))),e.push([o,a])}}this.flowers[t].push(...e)}return[]}}
function exportSVG(t,e){let r=createWriter("Marfa_Yucca_"+tokenData.tokenId+".svg");if(r.write(svgBeginDocument(t/100,e/100)),r.write(svgBeginGroup("MainLayer")),r.write(svgBeginGroup("background",cc[0],"noStroke")),r.write(svgPolygon([pv(0,0),pv(worldSpaceDims[0],0),pv(worldSpaceDims[0],worldSpaceDims[1]),pv(0,worldSpaceDims[1])])),r.write(svgEndGroup()),flowerPower&&1===artistStyle){r.write(svgBeginGroup("FrankeSquares"));for(let t=0;t<3;t++)r.write(svgBeginGroup("Squares_"+t,"noFill",franke[t],worldSpaceDims[0]/grid[0]/20*.09)),frankeSquares[t].forEach(t=>{r.write(svgPolygon(t))}),r.write(svgEndGroup());r.write(svgEndGroup())}r.write(svgBeginGroup("BoxFills")),rooms.forEach((t,e)=>{r.write(svgBeginGroup("BoxFill_"+e,cc[3],"noStroke")),r.write(svgPolygon(t.makeFillPoints())),r.write(svgEndGroup())}),r.write(svgEndGroup()),r.write(svgBeginGroup("Back of Boxes")),rooms.forEach((t,e)=>{r.write(svgBeginGroup("Lines_"+e,"noFill",cc[2],t.strokeBase)),flowerPower&&0===artistStyle?t.flowerPowerPts[0].forEach(t=>{r.write(svgCurve([t[0],t[1]]))}):(r.write(svgPolygon(t.boxBack)),r.write(svgCurve([t.boxBack[2],t.boxFront[2]],"noFill",cc[2],t.strokeBase,"round")),r.write(svgCurve([t.boxBack[3],t.boxFront[3]],"noFill",cc[2],t.strokeBase,"round")),t.offset[0]>0?r.write(svgCurve([t.boxBack[0],t.boxFront[0]],"noFill",cc[2],t.strokeBase,"round")):r.write(svgCurve([t.boxBack[1],t.boxFront[1]],"noFill",cc[2],t.strokeBase,"round"))),r.write(svgEndGroup())}),r.write(svgEndGroup()),r.write(svgBeginGroup("Yuccas")),rooms.forEach((t,e,s)=>{yuccas[e].forEach((t,s)=>{r.write(svgBeginGroup("Box_"+e+"_Yucca_"+s));for(let e=t.stemsInflated.length-1;e>=0;e--){let s=natural?yc[0]:cc[0];r.write(svgBeginGroup(e+"_TrunkFill",s,"noStroke")),r.write(svgPolygon(t.stemsInflated[e])),r.write(svgEndGroup());let o=natural?yc[1]:cc[1];r.write(svgBeginGroup(e+"_TrunkShag","noFill",o,.0025*t.strokeBase)),t.shag[e].forEach((e,s,l)=>{let a=lerpColor(color(yc[1]),color(yc[7]),map(l.length-s,l.length/2.73,0,0,1));s%2!=0&&natural?o=[a.levels[0],a.levels[1],a.levels[2]]:natural&&(o=yc[1]),natural?r.write(svgCurve([e[0],e[1]],"noFill",o,.0025*t.strokeBase)):r.write(svgCurve([e[0],e[1]]))}),r.write(svgEndGroup()),o=natural?yc[3]:cc[0],s=natural?yc[2]:cc[1],r.write(svgBeginGroup(e+"_Spear",s,o,.002*t.strokeBase)),r.write(svgPolygon(t.spearsInflated[e])),r.write(svgEndGroup()),o=natural?yc[3]:cc[1],r.write(svgBeginGroup(e+"_FlowerStems","noFill",o,.002*t.strokeBase)),t.flowers[e].forEach(t=>{r.write(svgCurve([t[0],t[1]]))}),r.write(svgEndGroup()),s=natural?yc[4]:cc[1],r.write(svgBeginGroup(e+"_Flowers",s,"noStroke")),t.flowers[e].forEach(e=>{r.write(svgCircle(e[1].x,e[1].y,t.stemBaseWidth/14/2,s,"noStroke"))}),r.write(svgEndGroup()),s=natural?yc[5]:cc[1],o=natural?yc[6]:cc[0],r.write(svgBeginGroup(e+"_Crown",s,o,.002*t.strokeBase));for(let s=0;s<t.crowns[e].length;s+=1)for(let o=0;o<t.crowns[e][s].length;o++)r.write(svgCurve(t.crowns[e][s][o]));r.write(svgEndGroup())}r.write(svgEndGroup())})}),r.write(svgEndGroup()),r.write(svgBeginGroup("Front of Boxes")),rooms.forEach((t,e)=>{r.write(svgBeginGroup("Lines_"+e,"noFill",cc[2],t.strokeBase)),flowerPower&&0===artistStyle?t.flowerPowerPts[1].forEach(e=>{r.write(svgCurve([e[0],e[1]],"noFill",cc[2],t.strokeBase))}):(r.write(svgPolygon(t.boxFront)),t.offset[0]<=0?r.write(svgCurve([t.boxBack[0],t.boxFront[0]],"noFill",cc[2],t.strokeBase,"round")):r.write(svgCurve([t.boxBack[1],t.boxFront[1]],"noFill",cc[2],t.strokeBase,"round"))),r.write(svgEndGroup())}),r.write(svgEndGroup()),r.write(svgBeginGroup("Text","noFill",textColor,2,"round","round","none")),words.forEach(t=>{t.forEach(t=>{t.forEach(t=>{r.write(svgCurve(t))})})}),r.write(svgEndGroup()),r.write(svgEndGroup()),r.write(svgEndDocument()),r.close()}function svgBeginDocument(t,e){return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'in" height="'+e+'in" viewBox="0 0 '+100*t+" "+100*e+'" style="background-color:hsl(100, 0%, 100%);" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:version="1.1.1 (c3084ef, 2021-09-22)">\n'}function svgEndDocument(){return"</svg>"}function svgBeginGroup(t,e="noFill",r="noStroke",s=0,o="square",l="miter",a="inline"){return'<g fill="'+svgParseColor(e)+'" stroke="'+svgParseColor(r)+'" display="'+a+'" stroke-width="'+s+'" stroke-linecap="'+o+'" stroke-linejoin="'+l+'" id="'+t+'" inkscape:groupmode="layer" inkscape:label="'+t+'">\n'}function svgEndGroup(){return"</g>\n"}function svgCircle(t,e,r){return'<circle cx="'+t+'" cy="'+e+'" r="'+r+'"/>\n'}function svgCurve(t,e="noFill",r="noStroke",s=0,o="square"){path='<polyline points="';for(let e=0;e<t.length;e++)path+=t[e].x+" "+t[e].y+" ";return e="noFill"==e?"":'fill="'+svgParseColor(e)+'" ',r="noStroke"==r?"":'stroke="'+svgParseColor(r)+'" ',s=0===s?"":'stroke-width="'+s+'" ',o="square"==o?"":'stroke-linecap="'+o+'"',path+='" '+e+r+s+o+"/>\n",path}function svgPolygon(t){path='<polygon points="';for(let e=0;e<t.length;e++)path+=t[e].x+" "+t[e].y+" ";return path+='"/>\n',path}function svgParseColor(t){return"noFill"==t||"noStroke"==t?"none":"rgb("+t[0]+","+t[1]+","+t[2]+")"}function svgText(t,e,r,s){return tag='<text x="'+e+'" y="'+r+'" stroke="none" font-family="sans-serif" fill="rgb('+textColor+')" text-anchor="'+s+'" font-size="18">'+t+"</text>\n",console.log(tag),tag}
let globalScaler=1,ratio=[3,4],worldSpaceDims=[1800,ratio[1]/ratio[0]*1800],worldMin=Math.min(worldSpaceDims[0],worldSpaceDims[1]);function scaleAgnosticCanvas(){let t=window.innerWidth,e=window.innerHeight;t*(ratio[1]/ratio[0])>e?createCanvas(e*(ratio[0]/ratio[1]),e):createCanvas(t,t*(ratio[1]/ratio[0])),globalScaler=getScalar(pv(0,0),pv(0,worldSpaceDims[0]),pv(0,0),pv(0,width))}class Random{constructor(){this.useA=!1;let t=function(t){let e=parseInt(t.substr(0,8),16),r=parseInt(t.substr(8,8),16),s=parseInt(t.substr(16,8),16),o=parseInt(t.substr(24,8),16);return function(){let t=((e|=0)+(r|=0)|0)+(o|=0)|0;return o=o+1|0,e=r^r>>>9,r=(s|=0)+(s<<3)|0,s=(s=s<<21|s>>>11)+t|0,(t>>>0)/4294967296}};this.prngA=new t(tokenData.hash.substr(2,32)),this.prngB=new t(tokenData.hash.substr(34,32));for(let t=0;t<1e6;t+=2)this.prngA(),this.prngB()}random_dec(){return this.useA=!this.useA,this.useA?this.prngA():this.prngB()}random_num(t,e){return t+(e-t)*this.random_dec()}}let ABR=new Random;function R(){return ABR.random_dec()}function RR(t,e){return ABR.random_num(t,e)}function purgePRNG(t){for(let e=0;e<t;e++)RR(0,1)}function pv(t,e,r){return new createVector(t,e,r)}function prepareColors(){0==palette?(cc[0]=[255,214,227],cc[1]=[74,36,51],cc[2]=[194,68,120],cc[3]=boxFill?[255,255,255]:cc[0]):1==palette?(cc[0]=[242,210,206],cc[1]=[138,0,0],cc[2]=[138,0,0],cc[3]=boxFill?[255,255,255]:cc[0]):2==palette?(cc[0]=[204,232,252],cc[2]=[0,55,94],cc[1]=[0,55,94],cc[3]=boxFill?[255,255,255]:cc[0]):3==palette?(cc[0]=[213,190,237],cc[1]=[55,29,82],cc[2]=[55,29,82],cc[3]=boxFill?[255,255,255]:cc[0]):4==palette?(cc[0]=[163,144,88],cc[1]=[64,44,0],cc[2]=[255,245,199],cc[3]=boxFill?[207,202,140]:cc[0]):5==palette?(cc[0]=[255,255,255],cc[1]=[0,0,0],cc[2]=[0,0,0],cc[3]=[255,255,255]):6==palette&&(cc[0]=[0,0,0],cc[1]=[255,255,255],cc[2]=[255,255,255],cc[3]=[0,0,0]),palette>6&&(cc[0]=boxFill?[204,204,204]:[230,230,230],cc[1]=[0,0,0],cc[3]=boxFill?[255,255,255]:cc[0],7==palette?cc[2]=[33,102,148]:8==palette?cc[2]=[112,59,148]:9==palette?(cc[0]=boxFill?[130,130,130]:[171,171,171],cc[2]=[255,208,0],cc[3]=boxFill?[171,171,171]:cc[0]):10==palette?cc[2]=[34,135,63]:11==palette&&(cc[2]=[219,71,42])),natural&&!boxFill&&(cc[0]=[15,51,79],cc[3]=cc[0],6==palette&&(cc[0]=[0,0,0],cc[3]=cc[0]),3!=palette&&8!=palette||(cc[2]=[147,73,227]),0==palette&&(cc[2]=[230,141,138]),1!=palette&&11!=palette||(cc[2]=[255,42,0]),2!=palette&&7!=palette||(cc[2]=[53,164,242]),3!=palette&&8!=palette||(cc[2]=[168,141,247]),4!=palette&&9!=palette||(cc[2]=[255,222,77]),10==palette&&(cc[2]=[95,194,79])),natural&&boxFill&&(11!=palette&&1!=palette||(cc[0]=[82,1,0],cc[2]=[252,158,139],cc[3]=[140,28,18]),7!=palette&&2!=palette||(cc[0]=[106,140,166],cc[2]=[230,245,255],cc[3]=[0,53,94]),8!=palette&&3!=palette||(cc[0]=[129,92,150],cc[2]=[222,187,237],cc[3]=[56,29,74]),9!=palette&&4!=palette||(cc[0]=[173,150,104],cc[2]=[252,220,76],cc[3]=[69,31,19]),10==palette&&(cc[0]=[0,102,31],cc[2]=[157,186,151],cc[3]=[29,51,35]),5==palette&&(cc[0]=[171,171,171],cc[3]=[171,171,171],cc[2]=[255,255,255]),6==palette&&(cc[0]=[22,22,23],cc[2]=[220,220,222],cc[3]=[42,42,46]),0==palette&&(cc[3]=[212,108,106],cc[2]=[255,207,207],cc[0]=[230,141,138])),textColor=(cc[0][0]+cc[0][1]+cc[0][2])/3<50?[cc[0][0]+100,cc[0][1]+100,cc[0][2]+100]:[cc[0][0]-100,cc[0][1]-100,cc[0][2]-100]}p5.disableFriendlyErrors=!0;let targetBoxes=[],strokeBase=1,yuccas=[],rooms=[],words=[];purgePRNG(100);let flowerPower=R()>.7;purgePRNG(100);let artistStyle=R()>.7?1:0;purgePRNG(100);let palette=Math.floor(RR(0,12));purgePRNG(100);let natural=R()>.85;purgePRNG(100);let boxFill=R()>.45;palette<5&&R()>.8&&(palette=Math.floor(RR(7,12))),flowerPower&&0==artistStyle&&(boxFill=!0);let frankeSquares=[],franke=[[245,7,162],[255,143,102],[77,77,77]],yc=[[97,69,29],[158,120,36],[150,132,111],[140,113,72],[255,250,186],[41,87,13],[89,153,20],[232,194,107]],cc=[],textColor=[];function average3(t,e,r){return pv((t.x+e.x+r.x)/3,(t.y+e.y+r.y)/3)}function soften(t){for(let e=1;e<t.length-1;e++){let r=average3(t[(e-1+t.length)%t.length],t[e%t.length],t[(e+1)%t.length]);t[e%t.length].set(r.x,r.y)}}function getDist(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}function getScalar(t,e,r,s){let o=[getDist(t,e),getDist(r,s)];return o[1]/o[0]}function fitScalar(t,e=10,r=[pv(0,0),pv(width,0),pv(width,height),pv(0,height)]){if(orients=[0,0],bbRatio=dist(t[0].x,t[0].y,t[3].x,t[3].y)/dist(t[0].x,t[0].y,t[1].x,t[1].y),motherRatio=dist(r[0].x,r[0].y,r[3].x,r[3].y)/dist(r[0].x,r[0].y,r[1].x,r[1].y),bbRatio<1&&motherRatio>1)return getScalar(t[0],t[1],pv(r[0].x+e,r[0].y),pv(r[1].x-e,r[1].y));if(bbRatio>1&&motherRatio<1)return getScalar(t[0],t[3],pv(r[0].x,r[0].y+e),pv(r[3].x,r[3].y-e));if(bbRatio>1&&motherRatio>1||bbRatio<1&&motherRatio<1){if(bbRatio<motherRatio)return getScalar(t[0],t[1],pv(r[0].x+e,r[0].y),pv(r[1].x-e,r[1].y));if(bbRatio>motherRatio)return getScalar(t[0],t[3],pv(r[0].x,r[0].y+e),pv(r[3].x,r[3].y-e))}}function canvasAsBB(){return{p1:pv(0,0),p2:pv(width,0),p3:pv(width,height),p4:pv(0,height),width:width,height:height,mp:pv(width/2,height/2)}}function getBB(t){let e=99999999,r=999999999,s=-99999999,o=-99999999;for(let l=0;l<t.length;l++)e=Math.min(e,t[l].x),r=Math.min(r,t[l].y),s=Math.max(s,t[l].x),o=Math.max(o,t[l].y);return{p1:pv(e,r),p2:pv(s,r),p3:pv(s,o),p4:pv(e,o),width:s-e,height:o-r,mp:pv((e+s)/2,(r+o)/2)}}function getBBdepth2(t){let e=99999999,r=999999999,s=-99999999,o=-99999999;for(let l=0;l<t.length;l++)for(let a=0;a<t[l].length;a++)e=Math.min(e,t[l][a].x),r=Math.min(r,t[l][a].y),s=Math.max(s,t[l][a].x),o=Math.max(o,t[l][a].y);return{p1:pv(e,r),p2:pv(s,r),p3:pv(s,o),p4:pv(e,o),width:s-e,height:o-r,mp:pv((e+s)/2,(r+o)/2)}}function combineBB(t){let e=99999999,r=999999999,s=-99999999,o=-99999999;for(let l=0;l<t.length;l++)e=Math.min(e,t[l].p1.x),r=Math.min(r,t[l].p1.y),s=Math.max(s,t[l].p3.x),o=Math.max(o,t[l].p3.y);bbWidth=s-e,bbHeight=o-r;let l=pv((e+s)/2,(r+o)/2);return{p1:pv(e,r),p2:pv(s,r),p3:pv(s,o),p4:pv(e,o),width:bbWidth,height:bbHeight,mp:l}}function scaleAndCenter(t,e){let r,s=getBB(t),o=160*R()+40;r=bounds[0]/bounds[1]>s[1]/s[2]?getScalar(s[0][1],s[0][2],pv(ori[0]+0,ori[1]+o),pv(ori[0]+0,ori[1]+bounds[1]-o)):getScalar(s[0][0],s[0][1],pv(ori[0]+o,ori[1]+0),pv(ori[0]+bounds[0]-o,ori[1]+0));for(let e=0;e<t.length;e++)t[e].sub(s[3].x,s[3].y),t[e].mult(r);s=getBB(t);for(let r=0;r<t.length;r++)if(e){let e=pv(ori[0]+bounds[0]/2,ori[1]+bounds[1]-(ori[1]+bounds[1])/8-(s[0][2].y-s[0][1].y)/2);t[r].add(e.x+-0,e.y)}else{let e=pv(ori[0]+bounds[0]/2,ori[1]+bounds[1]/2);t[r].add(e.x+-0,e.y)}if((s=getBB(t))[0][0].y<ori[1]+o)for(let e=0;e<t.length;e++){t[e].sub(s[3].x,s[3].y);let r=pv(ori[0]+bounds[0]/2,ori[1]+bounds[1]/2);t[e].add(r.x+-0,r.y)}}function pointDir(t,e){let r=degrees(Math.atan2(e.y-t.y,e.x-t.x)),s=p5.Vector.fromAngle(radians(r));return degrees(s.heading())}function pointFrom(t,e,r){return pv(t.x-Math.sin(radians(e))*r,t.y+Math.cos(radians(e))*r)}function rotatePoint(t,e,r){return t.sub(e.x,e.y),t.rotate(r),t.add(e.x,e.y),t}function breakLinks(t){let e=[];for(let r=0;r<t.length;r++)e.push(pv(t[r].x,t[r].y));return t=e,e}function quickLine(t,e){line(t.x,t.y,e.x,e.y)}function inflate(t,e,r=1,s=1){let o=[];o.push(pointFrom(t[0],findNormal2Pt(t[0],t[1]),e*r));for(let l=1;l<t.length-1;l++)o.push(pointFrom(t[l],findNormal3Pt(t[l-1],t[l],t[l+1]),e*map(l,1,t.length-1,r,s)));o.push(pointFrom(t[t.length-1],findNormal2Pt(t[t.length-2],t[t.length-1]),e*s)),o.push(pointFrom(t[t.length-1],findNormal2Pt(t[t.length-1],t[t.length-2]),e*s));for(let l=t.length-2;l>0;l--)o.push(pointFrom(t[l],findNormal3Pt(t[l+1],t[l],t[l-1]),e*map(l,t.length-1,1,s,r)));return o.push(pointFrom(t[0],findNormal2Pt(t[0],t[1])+180,e*r)),o}function findNormal3Pt(t,e,r){let s=pointDir(t,e),o=pointDir(e,r),l=p5.Vector.fromAngle(radians(s)),a=p5.Vector.fromAngle(radians(o));return degrees(l.heading())-degrees(a.angleBetween(l))/2}function findNormal2Pt(t,e){return pointDir(t,e)}function scaleArr(t,e=1,r){t=t.map(t=>{t.sub(r.x,r.y),t.mult(e),t.add(r.x,r.y)})}function scaleArrDouble(t,e=1,r){t.map(t=>{scaleArr(t,e,r)})}function translateArrDepth1(t,e,r){breakLinks(t);for(let s=0;s<t.length;s++){let o=pv(t[s].x,t[s].y);o.sub(e.x,e.y),o.add(r.x,r.y),t[s]=o}}function translateArrDepth2(t,e,r){for(let s=0;s<t.length;s++)translateArrDepth1(t[s],e,r)}function contour(t,e){let r=[];for(let s=0;s<t.length;s++){let o=pointNormal(t[(s-1+t.length)%t.length],t[s],t[(s+1)%t.length]),l=pointFrom(t[s],o,e);r.push(l)}return r}function pointNormal(t,e,r){let s=pointDir(t,e),o=pointDir(e,r),l=Math.atan2(Math.sin(radians(s))+Math.sin(radians(o)),Math.cos(radians(s))+Math.cos(radians(o)));return degrees(l)+180}function getBoxData(t){return{width:t[1].x-t[0].x,height:t[2].y-t[1].y,mp:pv((t[0].x+t[1].x)/2,(t[1].y+t[2].y)/2)}}function boxToBB(t){let e=getBoxData(t);return{p1:t[0],p2:t[1],p3:t[2],p4:t[3],width:e.width,height:e.height,mp:e.mp}}function hyperIntersect(t,e,r,s){var o,l,a;return 0!==(o=(e.x-t.x)*(s.y-r.y)-(s.x-r.x)*(e.y-t.y))&&(a=((s.y-r.y)*(s.x-t.x)+(r.x-s.x)*(s.y-t.y))/o,l=((t.y-e.y)*(s.x-t.x)+(e.x-t.x)*(s.y-t.y))/o,0<a&&a<1&&0<=l&&l<=1)}function pointInsideShape(t,e){let r=0;for(let s=0;s<e.length;s++)hyperIntersect(pv(-1e5,1e5),t,e[s],e[(s+1)%e.length])&&r++;return r%2==1&&r>0}
# Yuccas and Boxes --- One of the things I took away from my summer trip to Marfa was the need to spend more time taking in my surroundings and thinking back on my experiences. Witnessing the vast fields of yuccas flowering simultaneously and watching the sunrise over Judd's 100 untitled works in mill aluminum are two specific moments that will never leave my memory. Combining these two sensations resulted in generative arrangements of yuccas and boxes. ## While in Live View: * press the "p" key to download your generated output in SVG file format. * press the "c" key to toggle the title information at the bottom of the image