Fusion.Engine.Graphics.DebugLayer.DrawSphere C# (CSharp) Method

DrawSphere() public method

public DrawSphere ( System.Vector3 origin, float radius, Color color, int numSegments = 32 ) : void
origin System.Vector3
radius float
color Color
numSegments int
return void
		public void DrawSphere(Vector3 origin, float radius, Color color, int numSegments = 32)
		{
			int N = numSegments;
			Vector3[] points = new Vector3[N + 1];

			for (int i = 0; i <= N; i++)
			{
				points[i].X = origin.X + radius * (float)Math.Cos(Math.PI * 2 * i / N);
				points[i].Y = origin.Y;
				points[i].Z = origin.Z + radius * (float)Math.Sin(Math.PI * 2 * i / N);
			}

			for (int i = 0; i < N; i++)
			{
				DrawLine(points[i], points[i + 1], color);
			}

			for (int i = 0; i <= N; i++)
			{
				points[i].X = origin.X + radius * (float)Math.Cos(Math.PI * 2 * i / N);
				points[i].Y = origin.Y + radius * (float)Math.Sin(Math.PI * 2 * i / N);
				points[i].Z = origin.Z;
			}

			for (int i = 0; i < N; i++)
			{
				DrawLine(points[i], points[i + 1], color);
			}

			for (int i = 0; i <= N; i++)
			{
				points[i].X = origin.X;
				points[i].Y = origin.Y + radius * (float)Math.Cos(Math.PI * 2 * i / N);
				points[i].Z = origin.Z + radius * (float)Math.Sin(Math.PI * 2 * i / N);
			}

			for (int i = 0; i < N; i++)
			{
				DrawLine(points[i], points[i + 1], color);
			}
		}