Skip to content

Instantly share code, notes, and snippets.

@Vercidium
Last active May 4, 2019 02:35
Show Gist options
  • Save Vercidium/b1c0474195cd828d09fed099d75973b6 to your computer and use it in GitHub Desktop.
Save Vercidium/b1c0474195cd828d09fed099d75973b6 to your computer and use it in GitHub Desktop.
Arm Scaling
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