mirror of
https://github.com/wagesj45/CapyKit.git
synced 2024-12-21 04:42:29 -06:00
Calculation Helper
This commit is contained in:
parent
87bd044b31
commit
a30e502bc4
26 changed files with 873 additions and 3 deletions
20
CapyKit/Enumerations/MeasurementSystem.cs
Normal file
20
CapyKit/Enumerations/MeasurementSystem.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapyKit.Enumerations
|
||||
{
|
||||
/// <summary>
|
||||
/// An enumeration representing different measurement systems.
|
||||
/// </summary>
|
||||
public enum MeasurementSystem
|
||||
{
|
||||
/// <summary> The imperial measurement system. </summary>
|
||||
Imperial = 0,
|
||||
|
||||
/// <summary> The metric measurement system. </summary>
|
||||
Metric = 1
|
||||
}
|
||||
}
|
160
CapyKit/Helpers/CalculationHelper.cs
Normal file
160
CapyKit/Helpers/CalculationHelper.cs
Normal file
|
@ -0,0 +1,160 @@
|
|||
using CapyKit.Enumerations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapyKit.Helpers
|
||||
{
|
||||
/// <summary> Static class providing helper methods for various calculations. </summary>
|
||||
public static class CalculationHelper
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary> The earth's radius in kilometers. </summary>
|
||||
public const int EARTH_RADIUS_KILOMETERS = 6371;
|
||||
|
||||
/// <summary> Ratio of miles per kilometer . </summary>
|
||||
public const double MILES_PER_KILOMETER = 0.621371;
|
||||
|
||||
/// <summary> The valid hexidecimal characters. </summary>
|
||||
private const string chars = "0123456789ABCDEF";
|
||||
|
||||
#endregion Members
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the hash of a given string using an <see cref="MD5"/> value as the first 32 bits.
|
||||
/// </summary>
|
||||
/// <param name="str"> The string to be hashed. </param>
|
||||
/// <returns> The calculated hash. </returns>
|
||||
/// <remarks>
|
||||
/// This method is used for a quick and consistent hash function. It should not be considered
|
||||
/// cryptographically sound or used in security contexts.
|
||||
/// </remarks>
|
||||
public static int CalculateHash(string str)
|
||||
{
|
||||
MD5 md5Hasher = MD5.Create();
|
||||
var md5Hash = md5Hasher.ComputeHash(Encoding.UTF8.GetBytes(str));
|
||||
var hash = BitConverter.ToInt32(md5Hash, 0);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
/// <summary> Calculates the hexadecimal hash. </summary>
|
||||
/// <param name="str"> The string to be hashed. </param>
|
||||
/// <returns> The calculated 16 character hexadecimal hash. </returns>
|
||||
public static string CalculateHexHash(string str)
|
||||
{
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(str);
|
||||
|
||||
MD5 md5Hasher = MD5.Create();
|
||||
byte[] hash = md5Hasher.ComputeHash(bytes);
|
||||
|
||||
char[] hash2 = new char[16];
|
||||
|
||||
// Note that here we are wasting bits of hash!
|
||||
// But it isn't really important, because hash.Length == 32
|
||||
for (int i = 0; i < hash2.Length; i++)
|
||||
{
|
||||
hash2[i] = CalculationHelper.chars[hash[i] % CalculationHelper.chars.Length];
|
||||
}
|
||||
|
||||
return new string(hash2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the distance between two points on earth using the <c>haversine</c> formula.
|
||||
/// </summary>
|
||||
/// <param name="latitudeOrigin"> The latitude origin. </param>
|
||||
/// <param name="longitudeOrigin"> The longitude origin. </param>
|
||||
/// <param name="latitudeDestination"> The latitude destination. </param>
|
||||
/// <param name="longitudeDestination"> The longitude destination. </param>
|
||||
/// <param name="measurementSystem"> (Optional) The measurement system. </param>
|
||||
/// <returns> The distance. </returns>
|
||||
/// <remarks>
|
||||
/// Uses the <a href="https://www.movable-type.co.uk/scripts/latlong.html">haversine</a> formula
|
||||
/// to calculate the "as-the-crow-flies" distance between two points on earth.
|
||||
/// </remarks>
|
||||
/// <seealso cref="GetDistance(double, double, double, double, MeasurementSystem)"/>
|
||||
public static decimal GetDistance(decimal latitudeOrigin, decimal longitudeOrigin, decimal latitudeDestination, decimal longitudeDestination, MeasurementSystem measurementSystem = MeasurementSystem.Imperial)
|
||||
{
|
||||
double latitudeOriginalDouble = Convert.ToDouble(latitudeOrigin);
|
||||
double longitudeOriginDouble = Convert.ToDouble(longitudeOrigin);
|
||||
double latitudeDestinationDouble = Convert.ToDouble(latitudeDestination);
|
||||
double longitudeDestinationDouble = Convert.ToDouble(longitudeDestination);
|
||||
|
||||
var result = GetDistance(latitudeOriginalDouble, longitudeOriginDouble, latitudeDestinationDouble, longitudeDestinationDouble, measurementSystem);
|
||||
|
||||
return Convert.ToDecimal(result);
|
||||
}
|
||||
|
||||
/// <summary> Gets the distance between two points on earth using the <c>haversine</c> formula. </summary>
|
||||
/// <param name="latitudeOrigin"> The latitude of the origin. </param>
|
||||
/// <param name="longitudeOrigin"> The longitude of the origin. </param>
|
||||
/// <param name="latitudeDestination"> The latitude destination. </param>
|
||||
/// <param name="longitudeDestination"> The longitude destination. </param>
|
||||
/// <param name="measurementSystem"> (Optional) The measurement system. </param>
|
||||
/// <returns> The distance. </returns>
|
||||
/// <remarks>
|
||||
/// Uses the <a href="https://www.movable-type.co.uk/scripts/latlong.html">haversine</a> formula
|
||||
/// to calculate the "as-the-crow-flies" distance between two points on earth.
|
||||
/// </remarks>
|
||||
public static double GetDistance(double latitudeOrigin, double longitudeOrigin, double latitudeDestination, double longitudeDestination, MeasurementSystem measurementSystem = MeasurementSystem.Imperial)
|
||||
{
|
||||
var thetaLatitude = DegreesToRadians(latitudeOrigin);
|
||||
var thetaLongitude = DegreesToRadians(longitudeOrigin);
|
||||
var deltaLatitude = DegreesToRadians(latitudeDestination - latitudeOrigin);
|
||||
var deltaLongitude = DegreesToRadians(longitudeDestination - longitudeOrigin);
|
||||
|
||||
var haversineTheta = Math.Sin(deltaLatitude / 2) * Math.Sin(deltaLatitude / 2) + Math.Cos(thetaLatitude) * Math.Cos(thetaLongitude) * Math.Sin(deltaLongitude / 2) * Math.Sin(deltaLongitude / 2);
|
||||
var angularDistance = 2 * Math.Atan2(Math.Sqrt(haversineTheta), Math.Sqrt(1 - haversineTheta));
|
||||
|
||||
var distance = EARTH_RADIUS_KILOMETERS * angularDistance;
|
||||
|
||||
if (measurementSystem == MeasurementSystem.Imperial)
|
||||
{
|
||||
return KilometersToMiles(distance);
|
||||
}
|
||||
|
||||
return distance;
|
||||
}
|
||||
|
||||
/// <summary> Converts kilometers to miles. </summary>
|
||||
/// <param name="kilometers"> The value in kilometers. </param>
|
||||
/// <returns> The value in miles. </returns>
|
||||
public static double KilometersToMiles(double kilometers)
|
||||
{
|
||||
return kilometers * MILES_PER_KILOMETER;
|
||||
}
|
||||
|
||||
/// <summary> Converts miles to kilometers. </summary>
|
||||
/// <param name="miles"> The value in miles. </param>
|
||||
/// <returns> The value in kilometers. </returns>
|
||||
public static double MilesToKilometers(double miles)
|
||||
{
|
||||
return miles / MILES_PER_KILOMETER;
|
||||
}
|
||||
|
||||
/// <summary> Convers degrees to radians. </summary>
|
||||
/// <param name="degrees"> The degree value. </param>
|
||||
/// <returns> The value as radians. </returns>
|
||||
public static double DegreesToRadians(double degrees)
|
||||
{
|
||||
return degrees * Math.PI / 180.0;
|
||||
}
|
||||
|
||||
/// <summary> Converts radians to degrees. </summary>
|
||||
/// <param name="radians"> The radian value. </param>
|
||||
/// <returns> The value as degrees. </returns>
|
||||
public static double RadiansToDegrees(double radians)
|
||||
{
|
||||
return radians * 180.0 / Math.PI;
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
}
|
||||
}
|
|
@ -7,11 +7,18 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace CapyKit.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class for handling text transformations.
|
||||
/// </summary>
|
||||
public class LanguageHelper
|
||||
{
|
||||
#region Methods
|
||||
|
||||
/// <summary> Converts camel case text to human readable text. </summary>
|
||||
/// <remarks>
|
||||
/// Camel case is a naming convention for identifiers in which the first letter of each word is
|
||||
/// capitalized.
|
||||
/// </remarks>
|
||||
/// <param name="value"> The value. </param>
|
||||
/// <returns> A string in human readable format. </returns>
|
||||
public static string CamelCaseToHumanReadable(string value)
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
# EARTH_RADIUS_KILOMETERS Field
|
||||
|
||||
|
||||
The earth's radius in kilometers.
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
public const int EARTH_RADIUS_KILOMETERS = 6371
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
static val mutable EARTH_RADIUS_KILOMETERS: int
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Field Value
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.int32" target="_blank" rel="noopener noreferrer">Int32</a>
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -0,0 +1,31 @@
|
|||
# MILES_PER_KILOMETER Field
|
||||
|
||||
|
||||
Ratio of miles per kilometer .
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
public const double MILES_PER_KILOMETER = 0.621371
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
static val mutable MILES_PER_KILOMETER: float
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Field Value
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a>
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -0,0 +1,31 @@
|
|||
# chars Field
|
||||
|
||||
|
||||
The valid hexidecimal characters.
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
private const string chars = "0123456789ABCDEF"
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
static val mutable private chars: string
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Field Value
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a>
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -0,0 +1,24 @@
|
|||
# CalculationHelper Fields
|
||||
|
||||
|
||||
|
||||
|
||||
## Fields
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="F_CapyKit_Helpers_CalculationHelper_chars.md">chars</a></td>
|
||||
<td>The valid hexidecimal characters.</td></tr>
|
||||
<tr>
|
||||
<td><a href="F_CapyKit_Helpers_CalculationHelper_EARTH_RADIUS_KILOMETERS.md">EARTH_RADIUS_KILOMETERS</a></td>
|
||||
<td>The earth's radius in kilometers.</td></tr>
|
||||
<tr>
|
||||
<td><a href="F_CapyKit_Helpers_CalculationHelper_MILES_PER_KILOMETER.md">MILES_PER_KILOMETER</a></td>
|
||||
<td>Ratio of miles per kilometer .</td></tr>
|
||||
</table>
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -0,0 +1,41 @@
|
|||
# CalculateHash Method
|
||||
|
||||
|
||||
Calculates the hash of a given string using an <a href="https://learn.microsoft.com/dotnet/api/system.security.cryptography.md5" target="_blank" rel="noopener noreferrer">MD5</a> value as the first 32 bits.
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
public static int CalculateHash(
|
||||
string str
|
||||
)
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
static member CalculateHash :
|
||||
str : string -> int
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Parameters
|
||||
<dl><dt> <a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a></dt><dd>The string to be hashed.</dd></dl>
|
||||
|
||||
#### Return Value
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.int32" target="_blank" rel="noopener noreferrer">Int32</a>
|
||||
The calculated hash.
|
||||
|
||||
## Remarks
|
||||
This method is used for a quick and consistent hash function. It should not be considered cryptographically sound or used in security contexts.
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -0,0 +1,38 @@
|
|||
# CalculateHexHash Method
|
||||
|
||||
|
||||
Calculates the hexadecimal hash.
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
public static string CalculateHexHash(
|
||||
string str
|
||||
)
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
static member CalculateHexHash :
|
||||
str : string -> string
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Parameters
|
||||
<dl><dt> <a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a></dt><dd>The string to be hashed.</dd></dl>
|
||||
|
||||
#### Return Value
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a>
|
||||
The calculated 16 character hexadecimal hash.
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -0,0 +1,38 @@
|
|||
# DegreesToRadians Method
|
||||
|
||||
|
||||
Convers degrees to radians.
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
public static double DegreesToRadians(
|
||||
double degrees
|
||||
)
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
static member DegreesToRadians :
|
||||
degrees : float -> float
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Parameters
|
||||
<dl><dt> <a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a></dt><dd>The degree value.</dd></dl>
|
||||
|
||||
#### Return Value
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a>
|
||||
The value as radians.
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -0,0 +1,57 @@
|
|||
# GetDistance(Decimal, Decimal, Decimal, Decimal, MeasurementSystem) Method
|
||||
|
||||
|
||||
Gets the distance between two points on earth using the `haversine` formula.
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
public static decimal GetDistance(
|
||||
decimal latitudeOrigin,
|
||||
decimal longitudeOrigin,
|
||||
decimal latitudeDestination,
|
||||
decimal longitudeDestination,
|
||||
MeasurementSystem measurementSystem = MeasurementSystem.Imperial
|
||||
)
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
static member GetDistance :
|
||||
latitudeOrigin : decimal *
|
||||
longitudeOrigin : decimal *
|
||||
latitudeDestination : decimal *
|
||||
longitudeDestination : decimal *
|
||||
?measurementSystem : MeasurementSystem
|
||||
(* Defaults:
|
||||
let _measurementSystem = defaultArg measurementSystem MeasurementSystem.Imperial
|
||||
*)
|
||||
-> decimal
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Parameters
|
||||
<dl><dt> <a href="https://learn.microsoft.com/dotnet/api/system.decimal" target="_blank" rel="noopener noreferrer">Decimal</a></dt><dd>The latitude origin.</dd><dt> <a href="https://learn.microsoft.com/dotnet/api/system.decimal" target="_blank" rel="noopener noreferrer">Decimal</a></dt><dd>The longitude origin.</dd><dt> <a href="https://learn.microsoft.com/dotnet/api/system.decimal" target="_blank" rel="noopener noreferrer">Decimal</a></dt><dd>The latitude destination.</dd><dt> <a href="https://learn.microsoft.com/dotnet/api/system.decimal" target="_blank" rel="noopener noreferrer">Decimal</a></dt><dd>The longitude destination.</dd><dt> <a href="T_CapyKit_Enumerations_MeasurementSystem.md">MeasurementSystem</a> (Optional)</dt><dd>(Optional) The measurement system.</dd></dl>
|
||||
|
||||
#### Return Value
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.decimal" target="_blank" rel="noopener noreferrer">Decimal</a>
|
||||
The distance.
|
||||
|
||||
## Remarks
|
||||
Uses the <a href="https://www.movable-type.co.uk/scripts/latlong.html">
|
||||
|
||||
haversine</a> formula to calculate the "as-the-crow-flies" distance between two points on earth.
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="Overload_CapyKit_Helpers_CalculationHelper_GetDistance.md">GetDistance Overload</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
||||
<a href="M_CapyKit_Helpers_CalculationHelper_GetDistance_1.md">GetDistance(Double, Double, Double, Double, MeasurementSystem)</a>
|
|
@ -0,0 +1,56 @@
|
|||
# GetDistance(Double, Double, Double, Double, MeasurementSystem) Method
|
||||
|
||||
|
||||
Gets the distance between two points on earth using the `haversine` formula.
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
public static double GetDistance(
|
||||
double latitudeOrigin,
|
||||
double longitudeOrigin,
|
||||
double latitudeDestination,
|
||||
double longitudeDestination,
|
||||
MeasurementSystem measurementSystem = MeasurementSystem.Imperial
|
||||
)
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
static member GetDistance :
|
||||
latitudeOrigin : float *
|
||||
longitudeOrigin : float *
|
||||
latitudeDestination : float *
|
||||
longitudeDestination : float *
|
||||
?measurementSystem : MeasurementSystem
|
||||
(* Defaults:
|
||||
let _measurementSystem = defaultArg measurementSystem MeasurementSystem.Imperial
|
||||
*)
|
||||
-> float
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Parameters
|
||||
<dl><dt> <a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a></dt><dd>The latitude of the origin.</dd><dt> <a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a></dt><dd>The longitude of the origin.</dd><dt> <a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a></dt><dd>The latitude destination.</dd><dt> <a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a></dt><dd>The longitude destination.</dd><dt> <a href="T_CapyKit_Enumerations_MeasurementSystem.md">MeasurementSystem</a> (Optional)</dt><dd>(Optional) The measurement system.</dd></dl>
|
||||
|
||||
#### Return Value
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a>
|
||||
The distance.
|
||||
|
||||
## Remarks
|
||||
Uses the <a href="https://www.movable-type.co.uk/scripts/latlong.html">
|
||||
|
||||
haversine</a> formula to calculate the "as-the-crow-flies" distance between two points on earth.
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="Overload_CapyKit_Helpers_CalculationHelper_GetDistance.md">GetDistance Overload</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -0,0 +1,38 @@
|
|||
# KilometersToMiles Method
|
||||
|
||||
|
||||
Converts kilometers to miles.
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
public static double KilometersToMiles(
|
||||
double kilometers
|
||||
)
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
static member KilometersToMiles :
|
||||
kilometers : float -> float
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Parameters
|
||||
<dl><dt> <a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a></dt><dd>The value in kilometers.</dd></dl>
|
||||
|
||||
#### Return Value
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a>
|
||||
The value in miles.
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -0,0 +1,38 @@
|
|||
# MilesToKilometers Method
|
||||
|
||||
|
||||
Converts miles to kilometers.
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
public static double MilesToKilometers(
|
||||
double miles
|
||||
)
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
static member MilesToKilometers :
|
||||
miles : float -> float
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Parameters
|
||||
<dl><dt> <a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a></dt><dd>The value in miles.</dd></dl>
|
||||
|
||||
#### Return Value
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a>
|
||||
The value in kilometers.
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -0,0 +1,38 @@
|
|||
# RadiansToDegrees Method
|
||||
|
||||
|
||||
Converts radians to degrees.
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
public static double RadiansToDegrees(
|
||||
double radians
|
||||
)
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
static member RadiansToDegrees :
|
||||
radians : float -> float
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Parameters
|
||||
<dl><dt> <a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a></dt><dd>The radian value.</dd></dl>
|
||||
|
||||
#### Return Value
|
||||
<a href="https://learn.microsoft.com/dotnet/api/system.double" target="_blank" rel="noopener noreferrer">Double</a>
|
||||
The value as degrees.
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -30,6 +30,9 @@ static member CamelCaseToHumanReadable :
|
|||
<a href="https://learn.microsoft.com/dotnet/api/system.string" target="_blank" rel="noopener noreferrer">String</a>
|
||||
A string in human readable format.
|
||||
|
||||
## Remarks
|
||||
Camel case is a naming convention for identifiers in which the first letter of each word is capitalized.
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
# CalculationHelper Methods
|
||||
|
||||
|
||||
|
||||
|
||||
## Methods
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_CalculateHash.md">CalculateHash</a></td>
|
||||
<td>Calculates the hash of a given string using an <a href="https://learn.microsoft.com/dotnet/api/system.security.cryptography.md5" target="_blank" rel="noopener noreferrer">MD5</a> value as the first 32 bits.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_CalculateHexHash.md">CalculateHexHash</a></td>
|
||||
<td>Calculates the hexadecimal hash.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_DegreesToRadians.md">DegreesToRadians</a></td>
|
||||
<td>Convers degrees to radians.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_GetDistance.md">GetDistance(Decimal, Decimal, Decimal, Decimal, MeasurementSystem)</a></td>
|
||||
<td>Gets the distance between two points on earth using the <code>haversine</code> formula.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_GetDistance_1.md">GetDistance(Double, Double, Double, Double, MeasurementSystem)</a></td>
|
||||
<td>Gets the distance between two points on earth using the <code>haversine</code> formula.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_KilometersToMiles.md">KilometersToMiles</a></td>
|
||||
<td>Converts kilometers to miles.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_MilesToKilometers.md">MilesToKilometers</a></td>
|
||||
<td>Converts miles to kilometers.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_RadiansToDegrees.md">RadiansToDegrees</a></td>
|
||||
<td>Converts radians to degrees.</td></tr>
|
||||
</table>
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
13
Documentation/Help/N_CapyKit_Enumerations.md
Normal file
13
Documentation/Help/N_CapyKit_Enumerations.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# CapyKit.Enumerations Namespace
|
||||
|
||||
|
||||
\[Missing <summary> documentation for "N:CapyKit.Enumerations"\]
|
||||
|
||||
|
||||
|
||||
## Enumerations
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="T_CapyKit_Enumerations_MeasurementSystem.md">MeasurementSystem</a></td>
|
||||
<td>An enumeration representing different measurement systems.</td></tr>
|
||||
</table>
|
|
@ -8,11 +8,14 @@
|
|||
## Classes
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper</a></td>
|
||||
<td>Static class providing helper methods for various calculations.</td></tr>
|
||||
<tr>
|
||||
<td><a href="T_CapyKit_Helpers_CompressionHelper.md">CompressionHelper</a></td>
|
||||
<td>A class that contains methods for managing data compression.</td></tr>
|
||||
<tr>
|
||||
<td><a href="T_CapyKit_Helpers_LanguageHelper.md">LanguageHelper</a></td>
|
||||
<td> </td></tr>
|
||||
<td>Helper class for handling text transformations.</td></tr>
|
||||
<tr>
|
||||
<td><a href="T_CapyKit_Helpers_SecurityHelper.md">SecurityHelper</a></td>
|
||||
<td>A class that contains methods for managing secure data processing and cryptography.</td></tr>
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# GetDistance Method
|
||||
|
||||
|
||||
## Overload List
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_GetDistance.md">GetDistance(Decimal, Decimal, Decimal, Decimal, MeasurementSystem)</a></td>
|
||||
<td>Gets the distance between two points on earth using the <code>haversine</code> formula.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_GetDistance_1.md">GetDistance(Double, Double, Double, Double, MeasurementSystem)</a></td>
|
||||
<td>Gets the distance between two points on earth using the <code>haversine</code> formula.</td></tr>
|
||||
</table>
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="T_CapyKit_Helpers_CalculationHelper.md">CalculationHelper Class</a>
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -12,6 +12,9 @@
|
|||
<td><a href="N_CapyKit_Attributes.md">CapyKit.Attributes</a></td>
|
||||
<td /></tr>
|
||||
<tr>
|
||||
<td><a href="N_CapyKit_Enumerations.md">CapyKit.Enumerations</a></td>
|
||||
<td /></tr>
|
||||
<tr>
|
||||
<td><a href="N_CapyKit_Extensions.md">CapyKit.Extensions</a></td>
|
||||
<td /></tr>
|
||||
<tr>
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
# MeasurementSystem Enumeration
|
||||
|
||||
|
||||
An enumeration representing different measurement systems.
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Enumerations.md">CapyKit.Enumerations</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
public enum MeasurementSystem
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
type MeasurementSystem
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Members
|
||||
<table>
|
||||
<tr>
|
||||
<td>Imperial</td>
|
||||
<td>0</td>
|
||||
<td>The imperial measurement system.</td></tr>
|
||||
<tr>
|
||||
<td>Metric</td>
|
||||
<td>1</td>
|
||||
<td>The metric measurement system.</td></tr>
|
||||
</table>
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="N_CapyKit_Enumerations.md">CapyKit.Enumerations Namespace</a>
|
73
Documentation/Help/T_CapyKit_Helpers_CalculationHelper.md
Normal file
73
Documentation/Help/T_CapyKit_Helpers_CalculationHelper.md
Normal file
|
@ -0,0 +1,73 @@
|
|||
# CalculationHelper Class
|
||||
|
||||
|
||||
Static class providing helper methods for various calculations.
|
||||
|
||||
|
||||
|
||||
## Definition
|
||||
**Namespace:** <a href="N_CapyKit_Helpers.md">CapyKit.Helpers</a>
|
||||
**Assembly:** CapyKit (in CapyKit.dll) Version: 1.0.0
|
||||
|
||||
**C#**
|
||||
``` C#
|
||||
public static class CalculationHelper
|
||||
```
|
||||
**F#**
|
||||
``` F#
|
||||
[<AbstractClassAttribute>]
|
||||
[<SealedAttribute>]
|
||||
type CalculationHelper = class end
|
||||
```
|
||||
|
||||
<table><tr><td><strong>Inheritance</strong></td><td><a href="https://learn.microsoft.com/dotnet/api/system.object" target="_blank" rel="noopener noreferrer">Object</a> → CalculationHelper</td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
## Methods
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_CalculateHash.md">CalculateHash</a></td>
|
||||
<td>Calculates the hash of a given string using an <a href="https://learn.microsoft.com/dotnet/api/system.security.cryptography.md5" target="_blank" rel="noopener noreferrer">MD5</a> value as the first 32 bits.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_CalculateHexHash.md">CalculateHexHash</a></td>
|
||||
<td>Calculates the hexadecimal hash.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_DegreesToRadians.md">DegreesToRadians</a></td>
|
||||
<td>Convers degrees to radians.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_GetDistance.md">GetDistance(Decimal, Decimal, Decimal, Decimal, MeasurementSystem)</a></td>
|
||||
<td>Gets the distance between two points on earth using the <code>haversine</code> formula.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_GetDistance_1.md">GetDistance(Double, Double, Double, Double, MeasurementSystem)</a></td>
|
||||
<td>Gets the distance between two points on earth using the <code>haversine</code> formula.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_KilometersToMiles.md">KilometersToMiles</a></td>
|
||||
<td>Converts kilometers to miles.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_MilesToKilometers.md">MilesToKilometers</a></td>
|
||||
<td>Converts miles to kilometers.</td></tr>
|
||||
<tr>
|
||||
<td><a href="M_CapyKit_Helpers_CalculationHelper_RadiansToDegrees.md">RadiansToDegrees</a></td>
|
||||
<td>Converts radians to degrees.</td></tr>
|
||||
</table>
|
||||
|
||||
## Fields
|
||||
<table>
|
||||
<tr>
|
||||
<td><a href="F_CapyKit_Helpers_CalculationHelper_chars.md">chars</a></td>
|
||||
<td>The valid hexidecimal characters.</td></tr>
|
||||
<tr>
|
||||
<td><a href="F_CapyKit_Helpers_CalculationHelper_EARTH_RADIUS_KILOMETERS.md">EARTH_RADIUS_KILOMETERS</a></td>
|
||||
<td>The earth's radius in kilometers.</td></tr>
|
||||
<tr>
|
||||
<td><a href="F_CapyKit_Helpers_CalculationHelper_MILES_PER_KILOMETER.md">MILES_PER_KILOMETER</a></td>
|
||||
<td>Ratio of miles per kilometer .</td></tr>
|
||||
</table>
|
||||
|
||||
## See Also
|
||||
|
||||
|
||||
#### Reference
|
||||
<a href="N_CapyKit_Helpers.md">CapyKit.Helpers Namespace</a>
|
|
@ -1,7 +1,7 @@
|
|||
# LanguageHelper Class
|
||||
|
||||
|
||||
\[Missing <summary> documentation for "T:CapyKit.Helpers.LanguageHelper"\]
|
||||
Helper class for handling text transformations.
|
||||
|
||||
|
||||
|
||||
|
|
13
Documentation/Help/Working/_InheritedDocs_.xml
Normal file
13
Documentation/Help/Working/_InheritedDocs_.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<doc>
|
||||
<assembly>
|
||||
<name>_InheritedDocs_</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:CapyKit.Password.ToString">
|
||||
|
||||
<summary>Returns a string that represents the current object.</summary><returns>A string that represents the current object.</returns></member><member name="P:CapyKit.Pbkdf2Algorithm.AlgorithmName">
|
||||
|
||||
<summary>
|
||||
Gets the name of the algorithm.
|
||||
</summary></member></members>
|
||||
</doc>
|
|
@ -97,6 +97,8 @@
|
|||
- [EnumerationDescriptionAttribute Constructor](M_CapyKit_Attributes_EnumerationDescriptionAttribute__ctor.md)
|
||||
- [EnumerationDescriptionAttribute Properties](Properties_T_CapyKit_Attributes_EnumerationDescriptionAttribute.md)
|
||||
- [EnumerationDescriptionAttribute Methods](Methods_T_CapyKit_Attributes_EnumerationDescriptionAttribute.md)
|
||||
- [CapyKit.Enumerations Namespace](N_CapyKit_Enumerations.md)
|
||||
- [MeasurementSystem Enumeration](T_CapyKit_Enumerations_MeasurementSystem.md)
|
||||
- [CapyKit.Extensions Namespace](N_CapyKit_Extensions.md)
|
||||
- [EnumerationExtensions Class](T_CapyKit_Extensions_EnumerationExtensions.md)
|
||||
- [EnumerationExtensions Methods](Methods_T_CapyKit_Extensions_EnumerationExtensions.md)
|
||||
|
@ -128,6 +130,21 @@
|
|||
- [IfNullOrEmpty Method](M_CapyKit_Extensions_StringExtensions_IfNullOrEmpty.md)
|
||||
- [IfNullOrWhiteSpace Method](M_CapyKit_Extensions_StringExtensions_IfNullOrWhiteSpace.md)
|
||||
- [CapyKit.Helpers Namespace](N_CapyKit_Helpers.md)
|
||||
- [CalculationHelper Class](T_CapyKit_Helpers_CalculationHelper.md)
|
||||
- [CalculationHelper Methods](Methods_T_CapyKit_Helpers_CalculationHelper.md)
|
||||
- [CalculateHash Method](M_CapyKit_Helpers_CalculationHelper_CalculateHash.md)
|
||||
- [CalculateHexHash Method](M_CapyKit_Helpers_CalculationHelper_CalculateHexHash.md)
|
||||
- [DegreesToRadians Method](M_CapyKit_Helpers_CalculationHelper_DegreesToRadians.md)
|
||||
- [GetDistance Method](Overload_CapyKit_Helpers_CalculationHelper_GetDistance.md)
|
||||
- [GetDistance(Decimal, Decimal, Decimal, Decimal, MeasurementSystem) Method](M_CapyKit_Helpers_CalculationHelper_GetDistance.md)
|
||||
- [GetDistance(Double, Double, Double, Double, MeasurementSystem) Method](M_CapyKit_Helpers_CalculationHelper_GetDistance_1.md)
|
||||
- [KilometersToMiles Method](M_CapyKit_Helpers_CalculationHelper_KilometersToMiles.md)
|
||||
- [MilesToKilometers Method](M_CapyKit_Helpers_CalculationHelper_MilesToKilometers.md)
|
||||
- [RadiansToDegrees Method](M_CapyKit_Helpers_CalculationHelper_RadiansToDegrees.md)
|
||||
- [CalculationHelper Fields](Fields_T_CapyKit_Helpers_CalculationHelper.md)
|
||||
- [chars Field](F_CapyKit_Helpers_CalculationHelper_chars.md)
|
||||
- [EARTH_RADIUS_KILOMETERS Field](F_CapyKit_Helpers_CalculationHelper_EARTH_RADIUS_KILOMETERS.md)
|
||||
- [MILES_PER_KILOMETER Field](F_CapyKit_Helpers_CalculationHelper_MILES_PER_KILOMETER.md)
|
||||
- [CompressionHelper Class](T_CapyKit_Helpers_CompressionHelper.md)
|
||||
- [CompressionHelper Methods](Methods_T_CapyKit_Helpers_CompressionHelper.md)
|
||||
- [Compress Method](M_CapyKit_Helpers_CompressionHelper_Compress.md)
|
||||
|
|
Loading…
Reference in a new issue