Thread history
Jump to navigation
Jump to search
Time | User | Activity | Comment |
---|---|---|---|
No results |
I'm not sure, that i correctly understood your question and that its algorithm is completely correct, but idea must work, i think
double minAbsBearing = Integer.MAX_VALUE;
double minRelBearing = Integer.MAX_VALUE;
double maxRelBearing = Integer.MIN_VALUE;
for (ATarget target : enemys) {
double absBearing = ...; // me.angleTo(target) in my case
double relBearing = Utils.normalRelativeAngle(absBearing);
if (relBearing < minRelBearing) {
minAbsBearing = absBearing;
minRelBearing = relBearing;
}
if (relBearing > maxRelBearing) {
maxRelBearing = relBearing;
}
}
double widestArea = maxRelBearing - minRelBearing;
double startAngle = minAbsBearing;
double endAngle = Utils.normalAbsoluteAngle(minAbsBearing + widestArea);
Jdev