.collect(Collectors.toList()); if (l.isEmpty()) { thisNode.addPolarization(new Continuous2DEuclidean(0, 0)); } else { final boolean isNodeOnMaxConc = env.getPosition(l.stream() .get()).equals(env.getPosition(thisNode)); if (isNodeOnMaxConc) { thisNode.addPolarization(new Continuous2DEuclidean(0, 0)); } else { Position newPolVer = weightedAverageVectors(l, thisNode); ); if (newPolVerModule == 0) { thisNode.addPolarization(newPolVer); } else { newPolVer = new Continuous2DEuclidean(newPolVer.getCoordinate(0) / newPolVerModule, newPolVer.getCoordinate(1) / newPolVerModule); if (ascend) { thisNode.addPolarization(newPolVer); } else { thisNode.addPolarization(new Continuous2DEuclidean( -newPolVer.getCoordinate(0), -newPolVer.getCoordinate(1))
/** * */ @Override public void execute() { final double x = getRandomGenerator().nextFloat() - 0.5; final double y = getRandomGenerator().nextFloat() - 0.5; Position randomVersor = new Continuous2DEuclidean(x, y); if (x == 0) { randomVersor = new Continuous2DEuclidean(0, 1); } else if (y == 0) { randomVersor = new Continuous2DEuclidean(1, 0); } else { final double module = FastMath.sqrt(FastMath.pow(x, 2) + FastMath.pow(y, 2)); if (module == 0) { randomVersor = new Continuous2DEuclidean(0, 0); } else { randomVersor = new Continuous2DEuclidean(x / module, y / module); } } getNode().addPolarization(randomVersor); }