This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
ModelingEvolution.Drawing is a .NET library that provides generic math types and utilities for 2D drawing and geometry. It targets .NET 9.0 and is designed with high-performance generic math capabilities using INumber<T> constraints.
# Build the solution
dotnet build Sources/ModelingEvolution.Drawing.sln
# Build in Release configuration
dotnet build Sources/ModelingEvolution.Drawing.sln --configuration Release
# Run all tests
dotnet test Sources/ModelingEvolution.Drawing.Tests/ModelingEvolution.Drawing.Tests.csproj
# Run tests with detailed output
dotnet test Sources/ModelingEvolution.Drawing.Tests/ModelingEvolution.Drawing.Tests.csproj --verbosity normal --logger:"console;verbosity=detailed"
# Run a specific test
dotnet test Sources/ModelingEvolution.Drawing.Tests/ModelingEvolution.Drawing.Tests.csproj --filter "FullyQualifiedName~TestName"
# Create NuGet package
dotnet pack Sources/ModelingEvolution.Drawing/ModelingEvolution.Drawing.csproj --configuration Release
# Restore dependencies
dotnet restore Sources/ModelingEvolution.Drawing.slnAll major geometric types are implemented as generic structs with T constrained to numeric types (INumber<T> and related interfaces):
- Point: Cartesian 2D point representation
- Vector: 2D vector with magnitude and direction operations
- Rectangle: Axis-aligned rectangle with position and size
- Size: Width and height dimensions
- Matrix: 2D transformation matrix
- PolarPoint: Polar coordinate representation with conversions to/from Cartesian
- Degree and Radian: Angular measurements with automatic conversions
- BezierCurve: Cubic Bezier curve implementation
- PolygonalCurve: Series of connected line segments
- Polygon: Complex polygon operations with Clipper2 integration
- RadialCurveF: Radial curve implementations
Located in Sources/ModelingEvolution.Drawing/Equations/:
- LinearEquation: Line equations and intersections
- QuadraticEquation: Quadratic curve calculations
- CubicEquation: Cubic polynomial solutions
- CircleEquation: Circle geometry and intersections
- ProtoBuf-Net: All core types have
[ProtoContract]attributes for binary serialization - JSON Converters: Custom converters for Point, Polygon, and Color types
- Type Converters: System.ComponentModel converters for UI frameworks
- Color: RGBA color representation with web color parsing
- HsvColor: HSV color space with conversions to/from RGB
- Colors: Static color definitions and utilities
- Clipper2 (1.4.0): Advanced polygon clipping and offsetting operations
- protobuf-net (3.2.45): High-performance binary serialization
Tests use xUnit with:
- FluentAssertions: Readable assertion syntax
- NSubstitute: Mocking framework
- Test files follow pattern
*Tests.csinSources/ModelingEvolution.Drawing.Tests/
- All numeric types use generic math interfaces from .NET 7+ for maximum performance and flexibility
- The library generates XML documentation (
.xmlfiles) for IntelliSense support - Version numbers are managed in the
.csprojfile and should be updated for releases - GitHub Actions workflows handle CI/CD (see
.github/workflows/)