DOF polished

This commit is contained in:
2026-07-07 05:04:16 +04:00
parent 6024227716
commit 9f51c59508
6 changed files with 86 additions and 52 deletions

View File

@@ -13,6 +13,8 @@ import org.apache.commons.lang3.tuple.Triple;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
public class RealLensOpenGlFrameCapturer
extends OpenGlFrameCapturer<RealLensOpenGlFrame, RealLensOpenGlFrameCapturer.Data> {
@@ -37,12 +39,14 @@ public class RealLensOpenGlFrameCapturer
final float GOLDEN_ANGLE = (float) (Math.PI * (3.0 - Math.sqrt(5.0)));
float random_offset = (float) Math.sqrt(r*r/n) * 0.5f;
for (int i = 0; i < n; i++) {
float rr = r * (float) Math.sqrt((float) i / n);
float t = i * GOLDEN_ANGLE;
points[i] = new Data(
rr * (float) Math.cos(t),
rr * (float) Math.sin(t),
rr * (float) Math.cos(t) + (ThreadLocalRandom.current().nextFloat() * 2f - 1f) * random_offset,
rr * (float) Math.sin(t) + (ThreadLocalRandom.current().nextFloat() * 2f - 1f) * random_offset,
0f, 0f, 0f
);
}