Created
December 10, 2018 04:55
-
-
Save doxas/3a00fa73157db82af7e2798dad9a11d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let radius = 100.0; | |
let cb = Math.cbrt(Math.random()); // 一様乱数の立方根 | |
let yc = Math.random() * 2.0 - 1.0; // Y 方向のコサイン相当を単に乱数から得る | |
let yr = Math.sqrt(1.0 - yc * yc); // 逆数 | |
let th = Math.random() * Math.PI * 2.0; // XZ 平面に対するシータ | |
let point = [ | |
radius * cb * yr * Math.cos(th), | |
radius * cb * yc, | |
radius * cb * yr * Math.sin(th) | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment