Class CurveDebugDrawExtensions
- Assembly
- Thunder.UnitsNET.Vectors.Geometry.MonoGame.dll
public static class CurveDebugDrawExtensions
- Inheritance
-
CurveDebugDrawExtensions
- Inherited Members
Remarks
All curved shapes are approximated as polylines with a configurable number of line segments. A higher segment count produces smoother curves at the cost of more draw calls per shape. The default is 32 segments.
Methods
DebugDraw(Arc2, SpriteBatch, Texture2D, Transform2, Color, float, int)
Draws the arc as a polyline on the Microsoft.Xna.Framework.Graphics.SpriteBatch.
public static void DebugDraw(this Arc2 arc, SpriteBatch sb, Texture2D pixel, Transform2 worldToScreen, Color color, float thickness = 1, int segments = 32)
Parameters
arcArc2The arc in world space.
sbSpriteBatchThe Microsoft.Xna.Framework.Graphics.SpriteBatch. Must be in an active
Begin/Endblock.pixelTexture2DA 1×1 white pixel texture (see CreatePixelTexture(GraphicsDevice)).
worldToScreenTransform2The world-to-screen Transform2.
colorColorWireframe colour.
thicknessfloatLine thickness in pixels. Defaults to 1.
segmentsintApproximation segment count. Defaults to 32.
DebugDraw(Capsule2, SpriteBatch, Texture2D, Transform2, Color, float, int)
Draws the capsule wireframe on the Microsoft.Xna.Framework.Graphics.SpriteBatch.
public static void DebugDraw(this Capsule2 capsule, SpriteBatch sb, Texture2D pixel, Transform2 worldToScreen, Color color, float thickness = 1, int segments = 32)
Parameters
capsuleCapsule2The capsule in world space.
sbSpriteBatchThe Microsoft.Xna.Framework.Graphics.SpriteBatch. Must be in an active
Begin/Endblock.pixelTexture2DA 1×1 white pixel texture (see CreatePixelTexture(GraphicsDevice)).
worldToScreenTransform2The world-to-screen Transform2.
colorColorWireframe colour.
thicknessfloatLine thickness in pixels. Defaults to 1.
segmentsintSegments per semicircle. Defaults to 32.
DebugDraw(Circle2, SpriteBatch, Texture2D, Transform2, Color, float, int)
Draws the wireframe outline of circle on the Microsoft.Xna.Framework.Graphics.SpriteBatch.
public static void DebugDraw(this Circle2 circle, SpriteBatch sb, Texture2D pixel, Transform2 worldToScreen, Color color, float thickness = 1, int segments = 32)
Parameters
circleCircle2The circle in world space.
sbSpriteBatchThe Microsoft.Xna.Framework.Graphics.SpriteBatch. Must be in an active
Begin/Endblock.pixelTexture2DA 1×1 white pixel texture (see CreatePixelTexture(GraphicsDevice)).
worldToScreenTransform2The world-to-screen Transform2.
colorColorWireframe colour.
thicknessfloatLine thickness in pixels. Defaults to 1.
segmentsintApproximation segment count. Defaults to 32.
DebugDraw(Ellipse2, SpriteBatch, Texture2D, Transform2, Color, float, int)
Draws the wireframe outline of ellipse on the Microsoft.Xna.Framework.Graphics.SpriteBatch.
public static void DebugDraw(this Ellipse2 ellipse, SpriteBatch sb, Texture2D pixel, Transform2 worldToScreen, Color color, float thickness = 1, int segments = 32)
Parameters
ellipseEllipse2The ellipse in world space.
sbSpriteBatchThe Microsoft.Xna.Framework.Graphics.SpriteBatch. Must be in an active
Begin/Endblock.pixelTexture2DA 1×1 white pixel texture (see CreatePixelTexture(GraphicsDevice)).
worldToScreenTransform2The world-to-screen Transform2.
colorColorWireframe colour.
thicknessfloatLine thickness in pixels. Defaults to 1.
segmentsintApproximation segment count. Defaults to 32.
DebugDraw(Sector2, SpriteBatch, Texture2D, Transform2, Color, float, int)
Draws the wireframe sector (pie slice) on the Microsoft.Xna.Framework.Graphics.SpriteBatch.
public static void DebugDraw(this Sector2 sector, SpriteBatch sb, Texture2D pixel, Transform2 worldToScreen, Color color, float thickness = 1, int segments = 32)
Parameters
sectorSector2The sector in world space.
sbSpriteBatchThe Microsoft.Xna.Framework.Graphics.SpriteBatch. Must be in an active
Begin/Endblock.pixelTexture2DA 1×1 white pixel texture (see CreatePixelTexture(GraphicsDevice)).
worldToScreenTransform2The world-to-screen Transform2.
colorColorWireframe colour.
thicknessfloatLine thickness in pixels. Defaults to 1.
segmentsintApproximation segment count. Defaults to 32.
GetDebugScreenVertices(Arc2, Transform2, int)
Generates screen-space vertices for the arc, with segments+1 points
(one for each endpoint plus interior subdivision).
public static Vector2[] GetDebugScreenVertices(this Arc2 arc, Transform2 worldToScreen, int segments = 32)
Parameters
arcArc2The arc in world space.
worldToScreenTransform2The world-to-screen Transform2.
segmentsintNumber of line segments in the approximation. Defaults to 32.
Returns
- Vector2[]
Array of
segments+1 screen-space Microsoft.Xna.Framework.Vector2 values.
GetDebugScreenVertices(Capsule2, Transform2, int)
Generates screen-space vertices for the capsule outline as two semicircular caps connected
by straight sides. Returns 2×(segments+1) vertices; DrawClosedPolygon(SpriteBatch, Texture2D, Vector2[], Color, float)
connects the last vertex back to the first to close the shape.
public static Vector2[] GetDebugScreenVertices(this Capsule2 capsule, Transform2 worldToScreen, int segments = 32)
Parameters
capsuleCapsule2The capsule in world space.
worldToScreenTransform2The world-to-screen Transform2.
segmentsintSegments per semicircle. Defaults to 32.
Returns
- Vector2[]
Array of 2×(
segments+1) screen-space Microsoft.Xna.Framework.Vector2 values.
GetDebugScreenVertices(Circle2, Transform2, int)
Generates screen-space vertices approximating the circumference of circle
as a closed polygon with segments sides.
public static Vector2[] GetDebugScreenVertices(this Circle2 circle, Transform2 worldToScreen, int segments = 32)
Parameters
circleCircle2The circle in world space.
worldToScreenTransform2The world-to-screen Transform2.
segmentsintNumber of line segments (and vertices) to use. Defaults to 32.
Returns
- Vector2[]
Array of
segmentsscreen-space Microsoft.Xna.Framework.Vector2 values.
GetDebugScreenVertices(Ellipse2, Transform2, int)
Generates screen-space vertices approximating the perimeter of ellipse
as a closed polygon with segments sides.
public static Vector2[] GetDebugScreenVertices(this Ellipse2 ellipse, Transform2 worldToScreen, int segments = 32)
Parameters
ellipseEllipse2The ellipse in world space.
worldToScreenTransform2The world-to-screen Transform2.
segmentsintNumber of line segments (and vertices) to use. Defaults to 32.
Returns
- Vector2[]
Array of
segmentsscreen-space Microsoft.Xna.Framework.Vector2 values.
GetDebugScreenVertices(Sector2, Transform2, int)
Generates screen-space vertices for the sector outline as a closed polygon:
[center, arc_start, ...arc_interior..., arc_end].
PolygonDebugDrawExtensions-style DrawClosedPolygon closes the shape
by connecting arc_end back to center (the second radius line).
public static Vector2[] GetDebugScreenVertices(this Sector2 sector, Transform2 worldToScreen, int segments = 32)
Parameters
sectorSector2The sector in world space.
worldToScreenTransform2The world-to-screen Transform2.
segmentsintNumber of arc segments. Defaults to 32.
Returns
- Vector2[]
Array of
segments+2 screen-space Microsoft.Xna.Framework.Vector2 values.