Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A .NET library that provides strongly-typed implementations of multiple coordinate systems, including rectangular, polar, spherical, and geodetic.

License

NotificationsYou must be signed in to change notification settings

NetFabric/NetFabric.Numerics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to the documentation forNetFabric.Numerics, a powerful C# library that provides strongly-typed implementations of multiple coordinate systems, including rectangular, polar, spherical, and geodetic. Whether you're working with angles, points, or geographic coordinates, this library has you covered!

Note: TheNetFabric.Numerics library utilizes advanced generic math features, which are only available in .NET 7 and C# 11.Make sure you are using a compatible version of the framework before using this library.

Installation

To get started withNetFabric.Numerics, you need to install the library's NuGet packages. The library is divided into three packages, each serving a specific purpose:

Make sure to include the appropriate package(s) in your project, depending on your specific needs.

Strongly-Typed Approach

NetFabric.Numerics adopts a robust, strongly-typed methodology, harnessing the capabilities of generics to guarantee both type safety and adaptability. Through the utilization of generics, you have the ability to define the internal data type and the characteristics of the coordinate system without the need for additional memory allocation.

Let's take a look at some examples to illustrate this:

Strongly-Typed Points

When working with points in different coordinate systems,NetFabric.Numerics allows you to specify the data type used internally. Here's an example:

usingNetFabric.Numerics.Rectangular2D;varintegerPoint=newPoint<int>(0,0);// Point using integersvardoublePrecisionPoint=newPoint<double>(0.0,0.0);// Point using double precisionvarsinglePrecisionPoint=newPoint<float>(0.0,0.0);// Point using single precisionvarcheckedConversion=Point<float>.CreateChecked(doublePrecisionPoint);// Throws if overflow occursvarsaturatedConversion=Point<float>.CreateSaturating(doublePrecisionPoint);// Saturates if overflow occursvartruncatedConversion=Point<float>.CreateTruncating(doublePrecisionPoint);// Truncates if overflow occurs

By specifying the desired data type, you have control over the precision and memory usage of your points.

Strongly-Typed Angles

NetFabric.Numerics also supports strongly-typed angles, with support for various units of measurement. Here's an example:

usingNetFabric.Numerics;vardegreesAngle=newAngle<Degrees,double>(0.0);// Angle using degreesvarradiansAngle=newAngle<Radians,double>(0.0);// Angle using radiansvargradiansAngle=newAngle<Gradians,double>(0.0);// Angle using gradiansvarrevolutionsAngle=newAngle<Revolutions,double>(0.0);// Angle using revolutionsvardoublePrecisionAngle=newAngle<Degrees,double>(0.0);// Angle with double precisionvarsinglePrecisionAngle=newAngle<Degrees,float>(0.0);// Angle with single precision

You can choose the unit of measurement for your angles and specify the desired precision.

Strongly-Typed Polar Coordinates

NetFabric.Numerics provides strongly-typed polar coordinate implementations. Here's an example:

usingNetFabric.Numerics.Polar;vardegreesPoint=newPoint<Degrees,double>(0.0,0.0);// Polar point using degreesvarradiansPoint=newPoint<Radians,double>(0.0,0.0);// Polar point using radiansvargradiansPoint=newPoint<Gradians,double>(0.0,0.0);// Polar point using gradiansvarrevolutionsPoint=newPoint<Revolutions,double>(0.0,0.0);// Polar point using revolutionsvardoublePrecisionPoint=newPoint<Degrees,double>(0.0,0.0);// Polar point with double precisionvarsinglePrecisionPoint=newPoint<Degrees,float>(0.0,0.0);// Polar point with single precision

WithNetFabric.Numerics, you can work with polar coordinates using different units of measurement and specify the desired precision for the azimuth and radius.

Strongly-Typed Geodetic Coordinates

NetFabric.Numerics also supports strongly-typed geodetic coordinate implementations, specifically latitude and longitude. Here's an example:

usingNetFabric.Numerics.Geodesy.Geodetic2;varwgs84Point=newPoint<WGS84,Degrees,double>(new(0.0),new(0.0));// Geodetic point using WGS84 datumvarwgs1972Point=newPoint<WGS1972,Degrees,double>(new(0.0),new(0.0));// Geodetic point using WGS1972 datumvarnad83Point=newPoint<NAD83,Degrees,double>(new(0.0),new(0.0));// Geodetic point using NAD83 datumvarnad1927ConusPoint=newPoint<NAD1927CONUS,Degrees,double>(new(0.0),new(0.0));// Geodetic point using NAD1927CONUS datumvardoublePrecisionPoint=newPoint<WGS84,Degrees,double>(new(0.0),new(0.0));// Geodetic point with double precisionvarsinglePrecisionPoint=newPoint<WGS84,Degrees,float>(new(0.0f),new(0.0f));// Geodetic point with single precisionvarminutesPoint=newPoint<WGS84,Degrees,double>(Angle.ToDegrees<double>(0,0.0),Angle.ToDegrees<double>(0,0.0));// Geodetic point using degrees and minutesvarminutesSecondsPoint=newPoint<WGS84,Degrees,double>(Angle.ToDegrees<double>(0,0,0.0),Angle.ToDegrees<double>(0,0,0.0));// Geodetic point using degrees, minutes and secondsvar(degreesLatitude,minutesLatitude)=Angle.ToDegreesMinutes<double,int,double>(wgs84Point.Latitude);// Convert latitude to degrees and minutesvar(degreesLatitude2,minutesLatitude2,secondsLatitude)=Angle.ToDegreesMinutesSeconds<double,int,int,double>(wgs84Point.Latitude);// Convert latitude to degrees, minutes, and seconds

NetFabric.Numerics enables you to work with geodetic coordinates using various datums, allowing you to specify the desired precision and units of measurement for latitude and longitude.

This addition provides clarity about the usage of generic types for specifying data types and properties within theNetFabric.Numerics library, enhancing the documentation's value. If you have any further suggestions or updates, please feel free to let me know.

Credits

The following open-source projects are used to build and test this project:

License

This project is licensed under the MIT license. See theLICENSE file for more info.

About

A .NET library that provides strongly-typed implementations of multiple coordinate systems, including rectangular, polar, spherical, and geodetic.

Topics

Resources

License

Stars

Watchers

Forks

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp