Project

General

Profile

Actions

Improvement #1412

closed

Improve spawning algorithm to spawn in all board instead of circle

Added by Axel "Elanis" Soupé over 2 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
Start date:
03/15/2022
Due date:
% Done:

100%

Estimated time:
Spent time:

Description

Test:

function calcNextLayer() {
	prevLayer++;

	const layerMaxItemsPerLine = (-1 + prevLayer * 4);
	const layerMaxItemsPerColumn = (-1 + prevLayer * 2);

/*
	f(1) = (1/1)
	f(2) = (5/3)
	f(3) = (9/5)
	f(4) = (13/7)
	f(5) = (17/9)
*/

	const newPoints = [];
	for(let itemX = 0; itemX < layerMaxItemsPerLine; itemX++) {
		for(let itemY = 0; itemY < layerMaxItemsPerColumn; itemY++) {
			let x = (-0.5 * layerMaxItemsPerLine + itemX + 0.5) * itemsFinalDistance + itemsFinalDistance / 2;
			let y = (-0.5 * layerMaxItemsPerColumn + itemY + 0.5) * itemsFinalDistance + itemsFinalDistance / 2;

			if(!positions.find(p => p.x === x && p.y === y)) {
				newPoints.push({ x, y });
			}

			/*if(itemY === 0 || itemY === (layerMaxItemsPerColumn - 1) || itemX === 0 || itemX === (layerMaxItemsPerLine - 1)) {
				newPoints.push({
					x: (-0.5 * layerMaxItemsPerLine + itemX + 0.5) * itemsFinalDistance,
					y: (-0.5 * layerMaxItemsPerColumn + itemY + 0.5) * itemsFinalDistance,
				});
			}*/
		}
	}

	positions = [...positions, ...newPoints];

	console.log(newPoints);

	return newPoints;
}
Actions #1

Updated by Axel "Elanis" Soupé over 2 years ago

  • Translation missing: en.field_story_points set to 10
Actions #2

Updated by Axel "Elanis" Soupé 8 months ago

  • Subject changed from Move origin spawn point of elements to Improve spawning algorithm to spawn in all board instead of circle
  • Target version changed from Z - Backlog to Phosphorus
Actions #3

Updated by Axel "Elanis" Soupé 7 months ago

  • Description updated (diff)
Actions #4

Updated by Axel "Elanis" Soupé 7 months ago

  • Status changed from Pending to Closed
  • Target version changed from Phosphorus to Silicium

I ended up keeping the circle but improving the algorithm

Actions #5

Updated by Axel "Elanis" Soupé 7 months ago

  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF