Class PrimitiveDebugDrawExtensions
- 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
directionDirection2The direction in world space.
originLengthPoint2The arrow tail 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.
colorColorArrow colour.
thicknessfloatLine thickness in pixels. Defaults to 1.
pixelLengthfloatArrow 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
lineLengthLine2The line 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.
colorColorLine colour.
thicknessfloatLine thickness in pixels. Defaults to 1.
halfPixelLengthfloatHalf-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
rayLengthRay2The ray 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.
colorColorLine colour.
thicknessfloatLine thickness in pixels. Defaults to 1.
pixelLengthfloatLength 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
segmentLengthSegment2The segment 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.
colorColorLine colour.
thicknessfloatLine 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
transformTransform2The transform 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 camera world-to-screen Transform2.
xColorColor?Colour of the X axis (local right). Defaults to Microsoft.Xna.Framework.Color.Red.
yColorColor?Colour of the Y axis (local up). Defaults to Microsoft.Xna.Framework.Color.Green.
thicknessfloatLine thickness in pixels. Defaults to 1.
arrowLengthPxfloatLength 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
directionDirection2The direction in world space.
originLengthPoint2The arrow tail in world space.
worldToScreenTransform2The world-to-screen Transform2.
pixelLengthfloatArrow 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:
public static Vector2[] GetDebugScreenAxes(this Transform2 transform, Transform2 worldToScreen, float arrowLengthPx = 32)
Parameters
transformTransform2The transform in world space.
worldToScreenTransform2The camera world-to-screen Transform2.
arrowLengthPxfloatLength 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
lineLengthLine2The line in world space.
worldToScreenTransform2The world-to-screen Transform2.
halfPixelLengthfloatHalf-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
rayLengthRay2The ray in world space.
worldToScreenTransform2The world-to-screen Transform2.
pixelLengthfloatLength 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
segmentLengthSegment2The segment in world space.
worldToScreenTransform2The world-to-screen Transform2.
Returns
- Vector2[]
Array of 2 screen-space Microsoft.Xna.Framework.Vector2 values: [start, end].