Last active
May 4, 2019 02:35
-
-
Save Vercidium/b1c0474195cd828d09fed099d75973b6 to your computer and use it in GitHub Desktop.
Arm Scaling
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); | |
// Calculate the angle of this point inside its quadrant | |
var e = Math.Abs(Math.Abs(a) - Math.PI / 2); | |
var magnitude = galaxySize; | |
// Scale the point outwards if it lands within the scaling region | |
if (e > scalingAngleStart && e < scalingAngleEnd) | |
magnitude = magnitude * 2 / Math.Pow(e, scalingPower); | |
v.X *= magnitude; | |
v.Z *= magnitude; | |
v.Y = 0; | |
return v; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment