Compare commits
	
		
			No commits in common. "4224cb1b3b09a79ad3fc7afe92504bc912432497" and "583feac704188ccdc001945b3b33125dd3d68a3c" have entirely different histories.
		
	
	
		
			4224cb1b3b
			...
			583feac704
		
	
		
| @ -1,10 +1,5 @@ | ||||
| # CHANGELOG.md | ||||
| 
 | ||||
| ## v1.0.2 | ||||
| 
 | ||||
| * Fixed bug which was stopping slanted grids | ||||
| * Added noise | ||||
| 
 | ||||
| ## v1.0.1 | ||||
| 
 | ||||
| Added palettes | ||||
|  | ||||
| @ -1,6 +1,5 @@ | ||||
| // calculate tiles
 | ||||
| 
 | ||||
| 
 | ||||
| const RADIUS_OPTS = [  | ||||
| 	"const", | ||||
| 	"right", | ||||
| @ -13,21 +12,12 @@ const RADIUS_OPTS = [ | ||||
| 	"left-down", | ||||
| 	"in", | ||||
| 	"out", | ||||
| 	"noise", | ||||
| ]; | ||||
| 
 | ||||
| function distance(dx, dy) { | ||||
| 	return Math.sqrt(dx ** 2 + dy ** 2); | ||||
| } | ||||
| 
 | ||||
| function int_range(v1, v2) { | ||||
| 	const vs = [v1, v2]; | ||||
| 	vs.sort((a, b) => a - b); | ||||
| 	const low = Math.floor(vs[0]); | ||||
| 	const high = Math.ceil(vs[1]); | ||||
| 	return [...Array(high - low + 1).keys()].map((i) => i + low); | ||||
| } | ||||
| 
 | ||||
| class DotMaker { | ||||
| 	constructor(width) { | ||||
| 		this.width = width; | ||||
| @ -40,17 +30,19 @@ class DotMaker { | ||||
| 			return []; | ||||
| 		} | ||||
| 		const ps = []; | ||||
| 		const is = int_range(-this.width, this.width / m) | ||||
| 		is.map((i) => { | ||||
| 			const js = int_range(m * i + (m - n) * this.width, m * i) | ||||
| 			js.map((j) => { | ||||
| 		const imin = -this.width; | ||||
| 		const imax = this.width / m; | ||||
| 		for( let i = imin; i <= imax; i++ ) { | ||||
| 			const jmin = m * i + (m - n) * this.width; | ||||
| 			const jmax = m * i; | ||||
| 			for( let j = jmin; j <= jmax; j++ ) { | ||||
| 				const x = (j - m * i) / (m - n); | ||||
| 				const y = m * (x + i); | ||||
| 				if( x > 0 && y > 0 && x < this.width && y < this.width ) { | ||||
| 					ps.push({i:i, j:j, x:x, y:y}); | ||||
| 				} | ||||
| 			}); | ||||
| 		}); | ||||
| 			} | ||||
| 		} | ||||
| 		return ps; | ||||
| 	} | ||||
| 
 | ||||
| @ -78,14 +70,6 @@ class DotMaker { | ||||
| 	      		return 2 * maxr * distance((d.x - this.cx), (d.y - this.cy)) / this.width; | ||||
| 	      	case "in": | ||||
| 	      		return 2 * maxr * (0.5 * this.width - distance((d.x - this.cx), (d.y - this.cy))) / this.width; | ||||
| 
 | ||||
| 	      	// case "hyper-out":
 | ||||
| 	      	// 	return 2 * maxr * Math.abs(d.x - this.cx) (d.y - this.cy)) / this.width;
 | ||||
| 	      	// case "hyoer-in":
 | ||||
| 	      	// 	return 2 * maxr * (0.5 * this.width - distance((d.x - this.cx), (d.y - this.cy))) / this.width;
 | ||||
| 
 | ||||
| 	      	case "noise": | ||||
| 	      		return maxr * Math.random(); | ||||
| 	    	default: | ||||
| 	      		return maxr; | ||||
| 	  } | ||||
|  | ||||
| @ -4,7 +4,7 @@ toc: false | ||||
| 
 | ||||
| <h1>poptimal</h1> | ||||
| 
 | ||||
| <p>v1.0.2 | by <a href="https://mikelynch.org">mike lynch</a> | <a href="https://aus.social/@mikelynch">@mikelynch@aus.social</a> | <a href="https://git.tilde.town/bombinans/poptimal">source</a></p> | ||||
| <p>v1.0.1 | by <a href="https://mikelynch.org">mike lynch</a> | <a href="https://aus.social/@mikelynch">@mikelynch@aus.social</a> | <a href="https://git.tilde.town/bombinans/poptimal">source</a></p> | ||||
| 
 | ||||
| <div class="grid grid-cols-2"> | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user