Struct GradientSlopeCalculator
Object to cover the different types of Gradient and Slope calculations
Inherited Members
Namespace: FpAssistantCore.GeneralAviation
Assembly: FpAssistantCoreScl.dll
Syntax
public struct GradientSlopeCalculator
Remarks
There are three components which are a horizontal distance, a vertical distance and a gradient.
Constructors
View SourceGradientSlopeCalculator(LinearDistanceUnits, LinearDistanceUnits)
Constructor to initialise with a specific value and unit type
Declaration
public GradientSlopeCalculator(LinearDistanceUnits horizontalDistanceUnit, LinearDistanceUnits verticalDistanceUnit)
Parameters
Type | Name | Description |
---|---|---|
LinearDistanceUnits | horizontalDistanceUnit | Declare the linear distance unit for the horizontal distant parameter |
LinearDistanceUnits | verticalDistanceUnit | Unit type of the vertical distance used in the calculations |
Properties
View SourceGradientPercentage
Contains the numerical value of the gradient percentage
Declaration
public double GradientPercentage { get; set; }
Property Value
Type | Description |
---|---|
double | Numerical value of the percentage |
HorizontalDistance
Contains the numerical value of the distance
Declaration
public LinearDistance HorizontalDistance { get; set; }
Property Value
Type | Description |
---|---|
LinearDistance | Numerical value of the distance |
SlopeDegrees
Contains the numerical value of the slope angle in degrees
Declaration
public double SlopeDegrees { get; }
Property Value
Type | Description |
---|---|
double | Numerical value of the slope (Degrees) |
VerticalDistance
Contains the numerical value of the change in elevation along the distance
Declaration
public LinearDistance VerticalDistance { get; set; }
Property Value
Type | Description |
---|---|
LinearDistance | Numerical value of the change in elevation |
Methods
View SourceCalculateDistance()
Declaration
public void CalculateDistance()
CalculateElevationChange()
Declaration
public void CalculateElevationChange()
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Gradient percentage or Distance value must be greater than 0.0 |
CalculateGradient()
Declaration
public void CalculateGradient()
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Distance value must be greater than 0.0 |
DistanceFromHeightAndPercentage(double, double)
Calculates a horizontal distance based on a known vertical distance and a percentage slope
Declaration
public static double DistanceFromHeightAndPercentage(double height, double percentage)
Parameters
Type | Name | Description |
---|---|---|
double | height | vertical height gain |
double | percentage | Percentage |
Returns
Type | Description |
---|---|
double | Distance along the horizontal |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Percentage must be greater than 0 and not greater than 100 |
PercentageDistance(double, double)
Calculates a distance which is a percentage of another distance
Declaration
public static double PercentageDistance(double distance, double percentage)
Parameters
Type | Name | Description |
---|---|---|
double | distance | Distance for percentage calculation |
double | percentage | Percentage |
Returns
Type | Description |
---|---|
double | Value of the percentage distance |
Examples
50% of 200 units is 100 units
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Percentage must be greater than 0 and not greater than 100 |