Table of Contents

Class PrimitiveDebugDrawExtensions

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

DebugDraw extension methods for linear and directional primitives: LengthSegment2, LengthRay2, LengthLine2, Transform2, and Direction2.

public static class PrimitiveDebugDrawExtensions
Inheritance
PrimitiveDebugDrawExtensions
Inherited Members

Methods

DebugDraw(Direction2, LengthPoint2, SpriteBatch, Texture2D, Transform2, Color, float, float)

Draws an arrow representing direction from origin on the Microsoft.Xna.Framework.Graphics.SpriteBatch.

public static void DebugDraw(this Direction2 direction, LengthPoint2 origin, SpriteBatch sb, Texture2D pixel, Transform2 worldToScreen, Color color, float thickness = 1, float pixelLength = 50)

Parameters

direction Direction2

The direction in world space.

origin LengthPoint2

The arrow tail 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

Arrow colour.

thickness float

Line thickness in pixels. Defaults to 1.

pixelLength float

Arrow length in screen pixels. Defaults to 50.

DebugDraw(LengthLine2, SpriteBatch, Texture2D, Transform2, Color, float, float)

Draws a finite segment of line on the Microsoft.Xna.Framework.Graphics.SpriteBatch.

public static void DebugDraw(this LengthLine2 line, SpriteBatch sb, Texture2D pixel, Transform2 worldToScreen, Color color, float thickness = 1, float halfPixelLength = 500)

Parameters

line LengthLine2

The line 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

Line colour.

thickness float

Line thickness in pixels. Defaults to 1.

halfPixelLength float

Half-extent in pixels. Defaults to 500.

DebugDraw(LengthRay2, SpriteBatch, Texture2D, Transform2, Color, float, float)

Draws ray as an arrow on the Microsoft.Xna.Framework.Graphics.SpriteBatch.

public static void DebugDraw(this LengthRay2 ray, SpriteBatch sb, Texture2D pixel, Transform2 worldToScreen, Color color, float thickness = 1, float pixelLength = 100)

Parameters

ray LengthRay2

The ray 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

Line colour.

thickness float

Line thickness in pixels. Defaults to 1.

pixelLength float

Length of the drawn ray in screen pixels. Defaults to 100.

DebugDraw(LengthSegment2, SpriteBatch, Texture2D, Transform2, Color, float)

Draws segment as a line on the Microsoft.Xna.Framework.Graphics.SpriteBatch.

public static void DebugDraw(this LengthSegment2 segment, SpriteBatch sb, Texture2D pixel, Transform2 worldToScreen, Color color, float thickness = 1)

Parameters

segment LengthSegment2

The segment 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

Line colour.

thickness float

Line thickness in pixels. Defaults to 1.

DebugDraw(Transform2, SpriteBatch, Texture2D, Transform2, Color?, Color?, float, float)

Draws the transform's origin and two axes: X-axis in xColor, Y-axis in yColor.

public static void DebugDraw(this Transform2 transform, SpriteBatch sb, Texture2D pixel, Transform2 worldToScreen, Color? xColor = null, Color? yColor = null, float thickness = 1, float arrowLengthPx = 32)

Parameters

transform Transform2

The transform 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 camera world-to-screen Transform2.

xColor Color?

Colour of the X axis (local right). Defaults to Microsoft.Xna.Framework.Color.Red.

yColor Color?

Colour of the Y axis (local up). Defaults to Microsoft.Xna.Framework.Color.Green.

thickness float

Line thickness in pixels. Defaults to 1.

arrowLengthPx float

Length of each axis arrow in screen pixels. Defaults to 32.

GetDebugScreenArrow(Direction2, LengthPoint2, Transform2, float)

Returns two screen-space points: the arrow tail (world origin) and tip pixelLength pixels away in this direction's screen projection.

public static Vector2[] GetDebugScreenArrow(this Direction2 direction, LengthPoint2 origin, Transform2 worldToScreen, float pixelLength = 50)

Parameters

direction Direction2

The direction in world space.

origin LengthPoint2

The arrow tail in world space.

worldToScreen Transform2

The world-to-screen Transform2.

pixelLength float

Arrow length in screen pixels. Defaults to 50.

Returns

Vector2[]

Array of 2 screen-space Microsoft.Xna.Framework.Vector2 values: [tail, tip].

GetDebugScreenAxes(Transform2, Transform2, float)

Returns three screen-space positions representing the transform's world origin and the tips of its local X and Y axes:

  • [0] — origin
  • [1] — X-axis tip (along Rotation)
  • [2] — Y-axis tip (90° CCW from Rotation)
public static Vector2[] GetDebugScreenAxes(this Transform2 transform, Transform2 worldToScreen, float arrowLengthPx = 32)

Parameters

transform Transform2

The transform in world space.

worldToScreen Transform2

The camera world-to-screen Transform2.

arrowLengthPx float

Length of each axis arrow in screen pixels. Defaults to 32.

Returns

Vector2[]

Array of 3 screen-space Microsoft.Xna.Framework.Vector2 values.

GetDebugScreenPoints(LengthLine2, Transform2, float)

Returns two screen-space endpoints of a finite segment of the infinite line, centered on the line's reference point and extending halfPixelLength pixels in each direction.

public static Vector2[] GetDebugScreenPoints(this LengthLine2 line, Transform2 worldToScreen, float halfPixelLength = 500)

Parameters

line LengthLine2

The line in world space.

worldToScreen Transform2

The world-to-screen Transform2.

halfPixelLength float

Half-extent in pixels. Defaults to 500.

Returns

Vector2[]

Array of 2 screen-space Microsoft.Xna.Framework.Vector2 values: [from, to].

GetDebugScreenPoints(LengthRay2, Transform2, float)

Returns two screen-space points: the ray origin and a tip pixelLength pixels away in the ray's screen direction.

public static Vector2[] GetDebugScreenPoints(this LengthRay2 ray, Transform2 worldToScreen, float pixelLength = 100)

Parameters

ray LengthRay2

The ray in world space.

worldToScreen Transform2

The world-to-screen Transform2.

pixelLength float

Length of the drawn ray in screen pixels. Defaults to 100.

Returns

Vector2[]

Array of 2 screen-space Microsoft.Xna.Framework.Vector2 values: [origin, tip].

GetDebugScreenPoints(LengthSegment2, Transform2)

Returns the two screen-space endpoints of segment in [start, target] order.

public static Vector2[] GetDebugScreenPoints(this LengthSegment2 segment, Transform2 worldToScreen)

Parameters

segment LengthSegment2

The segment in world space.

worldToScreen Transform2

The world-to-screen Transform2.

Returns

Vector2[]

Array of 2 screen-space Microsoft.Xna.Framework.Vector2 values: [start, end].

latest ▼