DOF polished
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user