API Reference
Thunder.UnitsNET.Vectors is split across four packages, each covering a distinct layer. Use the namespace browser on the left to navigate to individual types, or jump directly using the table below.
Packages and namespaces
Thunder.UnitsNET.Vectors
Unit-aware 2D and 3D vector types. Every component is a UnitsNet quantity, so operations preserve physical units automatically. Arithmetic between vector types produces the correct quantity type: LengthVector2 / Duration returns SpeedVector2; ForceVector2.Dot(LengthVector2) returns Energy.
Foundational types
Physics vectors
Field and density vectors
Thunder.UnitsNET.Vectors.MonoGame
Conversion helpers between core vector types and MonoGame's Vector2 / Vector3, plus a camera type for world-to-screen projection.
Thunder.UnitsNET.Vectors.Geometry
Unit-aware 2D geometry shapes, a coordinate-frame transform, and directional types. All position coordinates use LengthPoint2 ; all displacement vectors use LengthVector2 .
Points and directions
Type
Description
LengthPoint2
A 2D point in physical length units
Direction2
A normalised 2D direction (wraps an Angle); East = +X
Transform2
A 2D coordinate frame: position + rotation (Direction2 ) + scale (Ratio)
Linear primitives
Shapes
Type
Description
Circle2
Circle defined by centre + Radius; FromPoints(p1, p2, p3) constructs the circumscribed circle
Rectangle2
Axis-aligned or rotated rectangle
Triangle2
Triangle with vertices A, B, C
Ellipse2
Ellipse with semi-major/minor axes and rotation
Arc2
Circular arc (partial circle); PointAt(Ratio), TangentAt(Ratio), FromPoints (circle+endpoints or 3-point with direction inference), CalculateArcPoints
Sector2
Pie-slice sector
Capsule2
Capsule (two semicircles + rectangle)
Polygon2
Arbitrary convex or concave polygon
Curves and paths
Type
Description
BezierCurve2
Cubic Bézier curve; Evaluate(Ratio), TangentAt(Ratio), ToPath(resolution), EvaluateAtLength(Length), TangentAtLength(Length)
CatmullRomSpline2
Catmull-Rom spline through waypoints; same API as BezierCurve2 plus ToPath(resolution)
LengthPath2
Arc-length parameterised polyline; Evaluate(Length), TangentAt(Length), SegmentAt(Length), Project(LengthPoint2), factories FromBezier, FromCatmullRom, FromArc
Thunder.UnitsNET.Vectors.Geometry.MonoGame
MonoGame/XNA conversion helpers for geometry types, plus the full DebugDraw wireframe rendering system.
Conversions
DebugDraw wireframe rendering
All DebugDraw methods take a SpriteBatch, a 1×1 pixel Texture2D (from DebugDrawExtensions.CreatePixelTexture ), and a world-to-screen Transform2 .
Type
Description
DebugDrawExtensions
Core helpers: CreatePixelTexture, DrawLine, WorldToScreen
PolygonDebugDrawExtensions
Wireframe for Rectangle2 , Triangle2 , Polygon2
CurveDebugDrawExtensions
Wireframe for Circle2 , Ellipse2 , Arc2 , Sector2 , Capsule2
PrimitiveDebugDrawExtensions
Wireframe for LengthSegment2 , LengthRay2 , LengthLine2 , Transform2 axes, Direction2 arrows
// One-time setup
Texture2D pixel = DebugDrawExtensions.CreatePixelTexture(GraphicsDevice);
// Per-frame, inside SpriteBatch.Begin/End
var worldToScreen = new Transform2(
LengthPoint2.FromMeters(400, 300), // screen centre
Direction2.East, // no camera rotation
Ratio.FromDecimalFractions(64.0)); // 64 pixels per metre
myCircle.DebugDraw(spriteBatch, pixel, worldToScreen, Color.Red);
myRect.DebugDraw(spriteBatch, pixel, worldToScreen, Color.Green);
myTransform.DebugDraw(spriteBatch, pixel, worldToScreen);