This file contains 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
Vector3 GetPoint() | |
{ | |
Vector3 v = Vector3.Zero; | |
// Generate a point | |
... | |
// Calculate the global angle of the point around the axis | |
var a = Math.Atan2(v.X, v.Z); |
This file contains 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
var v = GetPoint(); | |
// Add some variance to each star | |
v += NextV3(-0.5, 0.5); | |
// Shift stars vertically as they get closer to the center of the galaxy | |
var s = beamHeight / v.Magnitude; | |
v.Y = Next(-s, s); |
This file contains 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
Vector3 GetPoint() | |
{ | |
Vector3 v; | |
double armDivisor = Math.PI / armCount; | |
while (true) | |
{ | |
// Generate a random normalised point with a weighting | |
// towards the center controlled by the gravity variable | |
v = NextV3(-1, 1).Normalized() * Math.Pow(Next(0, 1.0), gravity); |
NewerOlder