Table of Contents

Class CurveDebugDrawExtensions

Namespace
Thunder.UnitsNET.Vectors.Geometry.MonoGame
Assembly
Thunder.UnitsNET.Vectors.Geometry.MonoGame.dll

DebugDraw extension methods for curved shapes: Circle2, Ellipse2, Arc2, Sector2, and Capsule2.

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

arc Arc2

The arc in world space.

sb SpriteBatch

The Microsoft.Xna.Framework.Graphics.SpriteBatch. Must be in an active Begin/End block.

pixel Texture2D

A 1×1 white pixel texture (see CreatePixelTexture(GraphicsDevice)).

worldToScreen Transform2

The world-to-screen Transform2.

color Color

Wireframe colour.

thickness float

Line thickness in pixels. Defaults to 1.

segments int

Approximation 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

capsule Capsule2

The capsule in world space.

sb SpriteBatch

The Microsoft.Xna.Framework.Graphics.SpriteBatch. Must be in an active Begin/End block.

pixel Texture2D

A 1×1 white pixel texture (see CreatePixelTexture(GraphicsDevice)).

worldToScreen Transform2

The world-to-screen Transform2.

color Color

Wireframe colour.

thickness float

Line thickness in pixels. Defaults to 1.

segments int

Segments 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

circle Circle2

The circle in world space.

sb SpriteBatch

The Microsoft.Xna.Framework.Graphics.SpriteBatch. Must be in an active Begin/End block.

pixel Texture2D

A 1×1 white pixel texture (see CreatePixelTexture(GraphicsDevice)).

worldToScreen Transform2

The world-to-screen Transform2.

color Color

Wireframe colour.

thickness float

Line thickness in pixels. Defaults to 1.

segments int

Approximation 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

ellipse Ellipse2

The ellipse in world space.

sb SpriteBatch

The Microsoft.Xna.Framework.Graphics.SpriteBatch. Must be in an active Begin/End block.

pixel Texture2D

A 1×1 white pixel texture (see CreatePixelTexture(GraphicsDevice)).

worldToScreen Transform2

The world-to-screen Transform2.

color Color

Wireframe colour.

thickness float

Line thickness in pixels. Defaults to 1.

segments int

Approximation 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

sector Sector2

The sector in world space.

sb SpriteBatch

The Microsoft.Xna.Framework.Graphics.SpriteBatch. Must be in an active Begin/End block.

pixel Texture2D

A 1×1 white pixel texture (see CreatePixelTexture(GraphicsDevice)).

worldToScreen Transform2

The world-to-screen Transform2.

color Color

Wireframe colour.

thickness float

Line thickness in pixels. Defaults to 1.

segments int

Approximation 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

arc Arc2

The arc in world space.

worldToScreen Transform2

The world-to-screen Transform2.

segments int

Number 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

capsule Capsule2

The capsule in world space.

worldToScreen Transform2

The world-to-screen Transform2.

segments int

Segments 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

circle Circle2

The circle in world space.

worldToScreen Transform2

The world-to-screen Transform2.

segments int

Number of line segments (and vertices) to use. Defaults to 32.

Returns

Vector2[]

Array of segments screen-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

ellipse Ellipse2

The ellipse in world space.

worldToScreen Transform2

The world-to-screen Transform2.

segments int

Number of line segments (and vertices) to use. Defaults to 32.

Returns

Vector2[]

Array of segments screen-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

sector Sector2

The sector in world space.

worldToScreen Transform2

The world-to-screen Transform2.

segments int

Number of arc segments. Defaults to 32.

Returns

Vector2[]

Array of segments+2 screen-space Microsoft.Xna.Framework.Vector2 values.

v0.7.0 ▼