2022-06-03 11:11:34 +00:00
|
|
|
|
using UnityEngine;
|
2022-06-01 18:00:36 +00:00
|
|
|
|
using X10D.Drawing;
|
|
|
|
|
using X10D.Numerics;
|
|
|
|
|
using X10D.Unity.Numerics;
|
|
|
|
|
using Quaternion = System.Numerics.Quaternion;
|
|
|
|
|
|
|
|
|
|
namespace X10D.Unity;
|
|
|
|
|
|
|
|
|
|
public static partial class DebugEx
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="center">The center point of the circle.</param>
|
|
|
|
|
/// <param name="radius">The radius of the circle.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
|
|
|
|
public static void DrawCircle(Vector2 center, float radius, int segments)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle(center, radius, segments, Color.white, DefaultDrawDuration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="center">The center point of the circle.</param>
|
|
|
|
|
/// <param name="radius">The radius of the circle.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(Vector2 center, float radius, int segments, in Color color)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle(center, radius, segments, color, DefaultDrawDuration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color and duration.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="center">The center point of the circle.</param>
|
|
|
|
|
/// <param name="radius">The radius of the circle.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
|
|
|
|
/// <param name="duration">
|
|
|
|
|
/// The duration of the circle's visibility, in seconds. If 0 is passed, the circle is visible for a single frame.
|
|
|
|
|
/// </param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(Vector2 center, float radius, int segments, in Color color, float duration)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle(center, radius, segments, Vector2.zero, color, duration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color and duration.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="center">The center point of the circle.</param>
|
|
|
|
|
/// <param name="radius">The radius of the circle.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
|
|
|
|
/// <param name="duration">
|
|
|
|
|
/// The duration of the circle's visibility, in seconds. If 0 is passed, the circle is visible for a single frame.
|
|
|
|
|
/// </param>
|
|
|
|
|
/// <param name="depthTest">
|
2022-06-03 11:10:43 +00:00
|
|
|
|
/// <see langword="true" /> if depth test should be applied; otherwise, <see langword="false" />. Passing
|
|
|
|
|
/// <see langword="true" /> will have the circle be obscured by objects closer to the camera.
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// </param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(Vector2 center, float radius, int segments, in Color color, float duration, bool depthTest)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle(center, radius, segments, Vector2.zero, color, duration, depthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="center">The center point of the circle.</param>
|
|
|
|
|
/// <param name="radius">The radius of the circle.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="offset">The drawing offset of the circle.</param>
|
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
|
|
|
|
/// <param name="duration">
|
|
|
|
|
/// The duration of the circle's visibility, in seconds. If 0 is passed, the circle is visible for a single frame.
|
|
|
|
|
/// </param>
|
|
|
|
|
/// <param name="depthTest">
|
2022-06-03 11:10:43 +00:00
|
|
|
|
/// <see langword="true" /> if depth test should be applied; otherwise, <see langword="false" />. Passing
|
|
|
|
|
/// <see langword="true" /> will have the circle be obscured by objects closer to the camera.
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// </param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(Vector2 center, float radius, int segments, in Vector3 offset, in Color color, float duration,
|
2022-06-01 18:00:36 +00:00
|
|
|
|
bool depthTest)
|
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle(new CircleF(center.ToSystemVector(), radius), segments, offset, color, duration, depthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
|
|
|
|
public static void DrawCircle(in Circle circle, int segments)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle((CircleF)circle, segments, Vector2.zero, Color.white, DefaultDrawDuration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="offset">The drawing offset of the circle.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(in Circle circle, int segments, in Vector3 offset)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle((CircleF)circle, segments, offset, Color.white, DefaultDrawDuration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(in Circle circle, int segments, in Color color)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle((CircleF)circle, segments, Vector2.zero, color, DefaultDrawDuration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="offset">The drawing offset of the circle.</param>
|
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(in Circle circle, int segments, in Vector3 offset, in Color color)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle((CircleF)circle, segments, offset, color, DefaultDrawDuration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color and duration.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
|
|
|
|
/// <param name="duration">
|
|
|
|
|
/// The duration of the circle's visibility, in seconds. If 0 is passed, the circle is visible for a single frame.
|
|
|
|
|
/// </param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(in Circle circle, int segments, in Color color, float duration)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle((CircleF)circle, segments, Vector2.zero, color, duration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color and duration.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="offset">The drawing offset of the circle.</param>
|
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
|
|
|
|
/// <param name="duration">
|
|
|
|
|
/// The duration of the circle's visibility, in seconds. If 0 is passed, the circle is visible for a single frame.
|
|
|
|
|
/// </param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(in Circle circle, int segments, in Vector3 offset, in Color color, float duration)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle((CircleF)circle, segments, offset, color, duration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color and duration.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
|
|
|
|
/// <param name="duration">
|
|
|
|
|
/// The duration of the circle's visibility, in seconds. If 0 is passed, the circle is visible for a single frame.
|
|
|
|
|
/// </param>
|
|
|
|
|
/// <param name="depthTest">
|
2022-06-03 11:10:43 +00:00
|
|
|
|
/// <see langword="true" /> if depth test should be applied; otherwise, <see langword="false" />. Passing
|
|
|
|
|
/// <see langword="true" /> will have the circle be obscured by objects closer to the camera.
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// </param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(in Circle circle, int segments, in Color color, float duration, bool depthTest)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle((CircleF)circle, segments, Vector2.zero, color, duration, depthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="offset">The drawing offset of the circle.</param>
|
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
|
|
|
|
/// <param name="duration">
|
|
|
|
|
/// The duration of the circle's visibility, in seconds. If 0 is passed, the circle is visible for a single frame.
|
|
|
|
|
/// </param>
|
|
|
|
|
/// <param name="depthTest">
|
2022-06-03 11:10:43 +00:00
|
|
|
|
/// <see langword="true" /> if depth test should be applied; otherwise, <see langword="false" />. Passing
|
|
|
|
|
/// <see langword="true" /> will have the circle be obscured by objects closer to the camera.
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// </param>
|
2022-07-08 12:08:24 +00:00
|
|
|
|
public static void DrawCircle(in Circle circle, int segments, in Vector3 offset, in Color color, float duration,
|
|
|
|
|
bool depthTest)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle((CircleF)circle, segments, offset, color, duration, depthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
|
|
|
|
public static void DrawCircle(in CircleF circle, int segments)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle(circle, segments, Color.white, DefaultDrawDuration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="offset">The drawing offset of the circle.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(in CircleF circle, int segments, in Vector3 offset)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle(circle, segments, offset, Color.white, DefaultDrawDuration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(in CircleF circle, int segments, in Color color)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle(circle, segments, Vector2.zero, color, DefaultDrawDuration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="offset">The drawing offset of the circle.</param>
|
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(in CircleF circle, int segments, in Vector3 offset, in Color color)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle(circle, segments, offset, color, DefaultDrawDuration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color and duration.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
|
|
|
|
/// <param name="duration">
|
|
|
|
|
/// The duration of the circle's visibility, in seconds. If 0 is passed, the circle is visible for a single frame.
|
|
|
|
|
/// </param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(in CircleF circle, int segments, in Color color, float duration)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle(circle, segments, Vector2.zero, color, duration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color and duration.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="offset">The drawing offset of the circle.</param>
|
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
|
|
|
|
/// <param name="duration">
|
|
|
|
|
/// The duration of the circle's visibility, in seconds. If 0 is passed, the circle is visible for a single frame.
|
|
|
|
|
/// </param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(in CircleF circle, int segments, in Vector3 offset, in Color color, float duration)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle(circle, segments, offset, color, duration, DefaultDepthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle with the specified color and duration.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
|
|
|
|
/// <param name="duration">
|
|
|
|
|
/// The duration of the circle's visibility, in seconds. If 0 is passed, the circle is visible for a single frame.
|
|
|
|
|
/// </param>
|
|
|
|
|
/// <param name="depthTest">
|
2022-06-03 11:10:43 +00:00
|
|
|
|
/// <see langword="true" /> if depth test should be applied; otherwise, <see langword="false" />. Passing
|
|
|
|
|
/// <see langword="true" /> will have the circle be obscured by objects closer to the camera.
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// </param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
public static void DrawCircle(in CircleF circle, int segments, in Color color, float duration, bool depthTest)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawCircle(circle, segments, Vector2.zero, color, duration, depthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Draws a circle.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="circle">The circle to draw.</param>
|
2022-06-03 11:11:34 +00:00
|
|
|
|
/// <param name="segments">The number of segments to generate.</param>
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// <param name="offset">The drawing offset of the circle.</param>
|
|
|
|
|
/// <param name="color">The color of the circle.</param>
|
|
|
|
|
/// <param name="duration">
|
|
|
|
|
/// The duration of the circle's visibility, in seconds. If 0 is passed, the circle is visible for a single frame.
|
|
|
|
|
/// </param>
|
|
|
|
|
/// <param name="depthTest">
|
2022-06-03 11:10:43 +00:00
|
|
|
|
/// <see langword="true" /> if depth test should be applied; otherwise, <see langword="false" />. Passing
|
|
|
|
|
/// <see langword="true" /> will have the circle be obscured by objects closer to the camera.
|
2022-06-01 18:00:36 +00:00
|
|
|
|
/// </param>
|
2022-07-08 12:08:24 +00:00
|
|
|
|
public static void DrawCircle(in CircleF circle, int segments, in Vector3 offset, in Color color, float duration,
|
|
|
|
|
bool depthTest)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
2022-06-03 11:11:34 +00:00
|
|
|
|
DrawPolyhedron(CreateCircle(circle.Radius, segments, Vector3.zero), offset, color, duration, depthTest);
|
2022-06-01 18:00:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-06-03 11:11:34 +00:00
|
|
|
|
private static Polyhedron CreateCircle(float radius, int segments, in Vector3 axis)
|
2022-06-01 18:00:36 +00:00
|
|
|
|
{
|
|
|
|
|
const float max = 2.0f * MathF.PI;
|
2022-06-03 11:11:34 +00:00
|
|
|
|
float step = max / segments;
|
2022-06-01 18:00:36 +00:00
|
|
|
|
|
|
|
|
|
var points = new List<System.Numerics.Vector3>();
|
|
|
|
|
for (var theta = 0f; theta < max; theta += step)
|
|
|
|
|
{
|
|
|
|
|
float x = radius * MathF.Cos(theta);
|
|
|
|
|
float y = radius * MathF.Sin(theta);
|
|
|
|
|
var vector = new System.Numerics.Vector3(x, y, 0);
|
|
|
|
|
|
|
|
|
|
if (axis != Vector3.zero)
|
|
|
|
|
{
|
|
|
|
|
vector = Quaternion.CreateFromAxisAngle(axis.ToSystemVector(), MathF.PI / 2.0f).Multiply(vector);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
points.Add(vector);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new Polyhedron(points);
|
|
|
|
|
}
|
|
|
|
|
}
|