Skip to content
Snippets Groups Projects
Commit fcac1a62 authored by JonStargaryen's avatar JonStargaryen
Browse files

sample only 1 hemisphere

parent 5eafddf9
No related branches found
No related tags found
No related merge requests found
......@@ -485,9 +485,9 @@ function generateSpherePoints(ctx: ANVILContext, numberOfSpherePoints: number):
const points = [];
let oldPhi = 0, h, theta, phi;
for(let k = 1, kl = numberOfSpherePoints + 1; k < kl; k++) {
h = -1 + 2 * (k - 1) / (numberOfSpherePoints - 1);
h = -1 + 2 * (k - 1) / (2 * numberOfSpherePoints - 1);
theta = Math.acos(h);
phi = (k === 1 || k === numberOfSpherePoints) ? 0 : (oldPhi + 3.6 / Math.sqrt(numberOfSpherePoints * (1 - h * h))) % (2 * Math.PI);
phi = (k === 1 || k === numberOfSpherePoints) ? 0 : (oldPhi + 3.6 / Math.sqrt(2 * numberOfSpherePoints * (1 - h * h))) % (2 * Math.PI);
const point = v3create(
extent * Math.sin(phi) * Math.sin(theta) + centroid[0],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment