function will_I_Collide(agents, candidate, scalingFactor) {
	let competitors = [];

	for (let i = 0; i < agents.length; i += 1) {
		let agent = agents[i];

		if (candidate.hasOwnProperty("index") && agent.index === candidate.index) {
			continue;
		}

		let dx = Math.abs(candidate.x - agent.x) * scalingFactor;
		let dy = Math.abs(candidate.y - agent.y) * scalingFactor;
		let d = Math.sqrt(dx * dx + dy * dy);
		let dScaled = parseFloat(d.toFixed(2)); // the agents are all on the universal scale, including their radii

		if (dScaled < MINIMUM_VIABILE_RADIUS) {
			competitors.push(agent);
		}

		if (dScaled < candidate.radius) {
			if (candidate.hasOwnProperty("status")) {
				// console.log("Prospective new location for", candidate.index, "with step size of", candidate.s, "at", candidate.x, candidate.y, "is only", dx, dy, d, dScaled, "from", agent);
			}
			// g.simulation.append("circle").attr("cx", x).attr("cy", y).attr("r", 3 * PIXELS_PER_FEET).style("fill", "black").attr("class", "dummy");
			return {
				competitors: competitors,
				collision: true
			}
		}
	}
	return {
		competitors: null,
		collision: false
	}
}
// don't recheck any agents outside this radius
don't recheck any agents outside this radius
don ' t recheck any agents outside this radius
function will_I_Collide(agents, candidate, scalingFactor) {
	let competitors = [];
	for (let i = 0; i < agents.length; i += 1) {
		let agent = agents[i];
		if (candidate.hasOwnProperty("index") && agent.index === candidate.index) {
			continue;
		}
		let dx = Math.abs(candidate.x - agent.x) * scalingFactor;
		let dy = Math.abs(candidate.y - agent.y) * scalingFactor;
		let d = Math.sqrt(dx * dx + dy * dy);
		let dScaled = parseFloat(d.toFixed(2)); 
		if (dScaled < MINIMUM_VIABILE_RADIUS) {
			competitors.push(agent);
		}
		if (dScaled < candidate.radius) {
			if (candidate.hasOwnProperty("status")) {
			}
			return {
				competitors: competitors,
				collision: true
			}
		}
	}
	return {
		competitors: null,
		collision: false
	}
}
function will_I_Collide ( agents , candidate , scalingFactor ) { let competitors = [ ] ; for ( let i = 0 ; i < agents . length ; i += 1 ) { let agent = agents [ i ] ; if ( candidate . hasOwnProperty ( "index" ) && agent . index === candidate . index ) { continue ; } let dx = Math . abs ( candidate . x - agent . x ) * scalingFactor ; let dy = Math . abs ( candidate . y - agent . y ) * scalingFactor ; let d = Math . sqrt ( dx * dx + dy * dy ) ; let dScaled = parseFloat ( d . toFixed ( 2 ) ) ; if ( dScaled < MINIMUM_VIABILE_RADIUS ) { competitors . push ( agent ) ; } if ( dScaled < candidate . radius ) { if ( candidate . hasOwnProperty ( "status" ) ) { } return { competitors : competitors , collision : true } } } return { competitors : null , collision : false } }
don't recheck any agents outside this radius
don ' t recheck any agents outside this radius
// the agents are all on the universal scale, including their radii // console.log("Prospective new location for", candidate.index, "with step size of", candidate.s, "at", candidate.x, candidate.y, "is only", dx, dy, d, dScaled, "from", agent); // g.simulation.append("circle").attr("cx", x).attr("cy", y).attr("r", 3 * PIXELS_PER_FEET).style("fill", "black").attr("class", "dummy");