Skip to content

Alternative math library based on .Net 7 generic math.

License

Notifications You must be signed in to change notification settings

jirikostiha/smath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMath

GitHub repo size GitHub code size Nuget
Build Code Analysis Code Lint

SMath is
  generic math library.
  set of static types.
  a different approach to math.

Features

The library is based on Generic math available since .NET 7.

Geometry 2D

Point
Euclidean distance, Manhattan distance, Chebyshev distance, Minkowski distance

Line
subelements: Ray, Line Segment
investigation: Projection, Intersection, Inclusion

Circle
subelements: Arc, Chord, Sector, Segment
investigation: Perimeter, Region, Tangent Points, Inclusion

Statistics

Correlation, Variance, Covariance, Standard Deviation, Histogram

Setup

Add nuget package to your project.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="SMath" Version="X.X.X" />
  </ItemGroup>
</Project>

Replace 'X.X.X' with a specific version.

Usage

// double numbers
var line1 = Circle.TangentLine.FromAngle(radius: 5d, angle: double.Pi / 4d);

// float numbers
var line2 = Circle.TangentLine.FromAngle(radius: 5f, angle: float.Pi / 4f);
var tangentPoints = Circle.TangentPoint.FromPoint(radius: 2d, (4, 4));
var secantLine = Line.FromTwoPoints(tangentPoints.Value.Point1, tangentPoints.Value.Point2);

Contributing

Any ideas, contributions and bug reports are welcome!

For new idea create an issue.
For bug report create an issue.
For contribution create a pull request.

License

Project is under MIT license.