Maths

Introduction

To uses these functions and features, do not forget to put this line of code in your "using" region:

C#

using LeoCorpLibrary;

VB

Imports LeoCorpLibrary

Maths Functions

There are multiple functions available in this part of LeoCorpLibrary.

a. Sum

This function is available in version 1.3 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The Sum() method enables you to do a sum of double numbers.

It's in:

LeoCorpLibrary.Maths.Sum()

You need to specify the numbers which you wanna get the sum of, in the argument section of the method.

Note

You can specify negative numbers.

Here's an example of usage:

C#

double numberSum = Maths.Sum(0, 2, 5, 6, 4);

VB

Dim numberSum As Double = Maths.Sum(0, 2, 5, 6, 4)

Go to top

b. GetBiggestNumber

This function is available in version 1.3 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetBiggestNumber() allows you to get the biggest number among double numbers that are specified. Returns a doublevalue.

It's in:

LeoCorpLibrary.Maths.GetBiggestNumber()

Note

You can use negative numbers

Here's an example of usage:

C#

double biggestNumber = Maths.GetBiggestNumber(0, 2, 3, 4, 5, 9, 8, 1);

VB

Dim biggestNumber As Double = Maths.GetBiggestNumber(0, 2, 3, 4, 5, 9, 8, 1)

Go to top

c. GetLowestNumber

This function is available in version 1.3.1 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetLowestNumber() method allows you to get the lowest number among double numbers that are specified. Returns a double value.

It's in:

LeoCorpLibrary.Maths.GetLowestNumber()

Note

You can use negative numbers.

Here's an example of usage:

C#

double lowestNumber = Maths.GetLowestNumber(0, 2, -1, 2.32);

VB

Dim lowestNumber As Double = Maths.GetLowestNumber(0, 2, -1, 2.32)

Go to top

d. RadiansToDegrees

This function is available in version 3.5 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The RadiansToDegrees() method allows you to convert radians to degrees. Returns a double value.

It's in:

LeoCorpLibrary.Maths.RadiansToDegrees()

It has one argument:

ValueArgumentDescriptionExample
doubleradiansRadians to convert1.5

Here's an example of usage:

C#

double degrees = Maths.RadiansToDegrees(1.57079633);
// Expected result: 90°

VB

Dim degrees As Double =  Maths.RadiansToDegrees(1.57079633)
' Expected result: 90°

Go to top

e. DegreesToRadians

This function is available in version 3.5 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The DegreesToRadians() method allows you to convert degrees to radians. Returns a double value.

It's in:

LeoCorpLibrary.Maths.DegreesToRadians()

It has one argument:

ValueArgumentDescriptionExample
doubledegreesDegrees to convert60

Here's an example of usage:

C#

double degrees = Maths.DegreesToRadians(90);
// Expected result: 1.57079633

VB

Dim degrees As Double =  Maths.DegreesToRadians(90)
' Expected result: 1.57079633

Go to top

e. IsInteger

This function is available in version 3.11 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The IsInteger() method allows you to check if a double number is an integer (int) or not.

It's in:

LeoCorpLibrary.Maths.IsInteger()

This method has one argument:

TypeArgumentDescription
doublenumberThe number to test

Here's an example of usage:

C#

bool isInt = Maths.IsInteger(10.5);
// isInt = false

bool isInt2 = Maths.IsInteger(4);
// IsInt2 = true

VB

Dim isInt As Boolean = Maths.IsInteger(10.5);
' isInt = false

Dim isInt2 As Boolean = Maths.IsInteger(4);
' IsInt2 = true

Go to top

f. GetOpposite

This function is available in version 4.2 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetOpposite() method allows you to get the opposite of a specified number. It returns a double value.

It's in:

LeoCorpLibrary.Maths.GetOpposite()

Note

You can use negative numbers.

This method has one argument:

TypeArgumentDescription
doublenThe number to get the opposite

Here's an example of usage:

C#

double x = 54;
double oppositeOfX = Maths.GetOpposite(x);

// oppositeOfX = -54

VB

Dim x As Double = 54
Dim oppositeOfX As Double = Maths.GetOpposite(x)

' oppositeOfX = -54

Go to top

g. Factorial

This function is available in version 4.2 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The Factorial() method allows you to get the factorial of a specified number. It returns an int value.

It's in:

LeoCorpLibrary.Maths.Factorial()

Remark

If the factorial of the specified number is greater than int.MaxValue, the method will either return 0, or a wrong result.

This method has one argument:

TypeArgumentDescription
doublenThe number to get the factorial

Here's an example of usage:

C#

int x = 5;
int f = Maths.Factorial(x);

// f = 520

VB

Dim x As Integer = 5
Dim f As Integer = Maths.Factorial(x)

' f = 520

Go to top

h. GetPositive

This function is available in version 4.6 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetPositive() method allows you to get the positive of a specified number. It returns a double value.

It's in:

LeoCorpLibrary.Maths.GetPositive()

This method has one argument:

TypeArgumentDescription
doublenThe number to get the positive

Here's an example of usage:

C#

double x = -54;
double positiveOfX = Maths.GetPositive(x);

// positiveOfX = 54

VB

Dim x As Double = -54
Dim positiveOfX As Double = Maths.GetPositive(x)

' positiveOfX = 54

Go to top

i. GetNegative

This function is available in version 4.6 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetNegative() method allows you to get the negative of a specified number. It returns a double value.

It's in:

LeoCorpLibrary.Maths.GetNegative()

This method has one argument:

TypeArgumentDescription
doublenThe number to get the negative

Here's an example of usage:

C#

double x = 54;
double negativeOfX = Maths.GetNegative(x);

// negativeOfX = -54

VB

Dim x As Double = 54
Dim negativeOfX As Double = Maths.GetNegative(x)

' negativeOfX = -54

Go to top

j. GetResultsOf

This function is available in version 4.6 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetResultsOf() method allows you to get the results of a specified function once applied to specified numbers. It returns an array double[] value.

It's in:

LeoCorpLibrary.Maths.GetResultsOf()

This method has two arguments:

TypeArgumentDescription
Func<double, double>functionThe function to apply
params double[]numbersThe numbers you want to get the results after applying a specific function

Here's an example of usage:

C#

double[] results = Maths.GetResultsOf(x => x * x, 1, 2, 3, 4, 5);

// results = { 1, 4, 9, 16, 25 }

VB

Dim results As Double() = Maths.GetResultsOf(Function(x) x * x, 1, 2, 3, 4, 5)

' results = { 1, 4, 9, 16, 25 }

Go to top

k. IsPositive

This function is available in version 4.7 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The IsPositive() method allows you to get if a specified number is positive or not. It returns a double value.

It's in:

LeoCorpLibrary.Maths.IsPositive()

It has one argument:

TypeArgumentDescription
doublenThe number to check

Here's an example of usage:

C#

double n = 45;
bool isPositive = Maths.IsPositive(n);

// isPositive = true

VB

Dim n As Double = 45
Dim isPositive As Boolean = Maths.IsPositive(n)

' isPositive = true

Go to top

l. IsNegative

This function is available in version 4.7 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The IsNegative() method allows you to get if a specified number is negative or not. It returns a double value.

It's in:

LeoCorpLibrary.Maths.IsNegative()

It has one argument:

TypeArgumentDescription
doublenThe number to check

Here's an example of usage:

C#

double n = 45;
bool isNegative = Maths.IsNegative(n);

// isNegative = false

VB

Dim n As Double = 45
Dim isNegative As Boolean = Maths.IsNegative(n)

' isNegative = false

Go to top

Circle

a. GetArea

This function is available in version 1.3 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetArea() method allows you to get the area of circle. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Circle.GetArea()

This method has one argument:

ValueArgumentDescriptionExample
doubleradiusCircle's radius15.12

Here's an example of usage:

C#

double circleArea = Maths.Circle.GetCircleArea(12.458);

VB

Dim circleArea As Double = Maths.Circle.GetCircleArea(12.458)

Go to top

b. GetPerimeter

This function is available in version 1.3 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetPerimeter() allows you to get the perimeter of a circle. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Circle.GetPerimeter()

This method has one argument:

ValueArgumentDescriptionExample
doubleradiusCircle's radius14.1

Here's an example of usage:

C#

double circlePerimeter = Maths.Circle.GetPerimeter(11.2);

VB

Dim circlePerimeter As Double = Maths.Circle.GetPerimeter(11.2)

Go to top

Rectangle

a. GetDiagonal

This function is available in version 3.2 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetDiagonal() method allows you to get a rectangle's diagonal. It returns a double value.

It's in:

LeoCorpLibrary.Maths.Rectangle.GetDiagonal()

This method has two arguments:

ValueArgumentDescriptionExample
doublewidthRectangle's width/base4.12
doublelengthRectangle's length8.5

Here's an example of usage:

C#

double diagonal = Maths.Rectangle.GetDiagonal(4.12, 8.5); // Get diagonal

VB

Dim diagonal As Double = Maths.Rectangle.GetDiagonal(4.12, 8.5) ' Get diagonal

Go to top

b. GetArea

This function is available in version 3.10 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetArea() method allows you to get a rectangle's area. It returns a double value.

It's in:

LeoCorpLibrary.Maths.Rectangle.GetArea()

This method has two arguments:

ValueArgumentDescriptionExample
doublewidthRectangle's width/base6
doublelengthRectangle's length12.2

Here's an example of usage:

C#

double area = Maths.Rectangle.GetArea(5, 10);
// area = 50

VB

Dim area = Maths.Rectangle.GetArea(5, 10)
' area = 50

Go to top

Triangle

a. GetArea

This function is available in version 1.3 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetArea() method allows you to get the area of a triangle. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Triangle.GetArea()

This method has two arguments:

ValueArgumentDescriptionExample
doubleheightTriangle's height5.48
doublewidthTriangle's width/base4.12

Here's an example of usage:

C#

double triangleArea = Maths.Triangle.GetArea(5.48, 4.12);

VB

Dim triangleArea As Double = Maths.Triangle.GetArea(5.48, 4.12)

Go to top

b. GetPerimeter

This function is available in version 1.3 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetPerimeter() method allows you to get the perimeter of a triangle. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Triangle.GetPerimeter()

This method has three arguments:

ValueArgumentDescriptionExample
doubleside1Triangle's side5.48
doubleside2Triangle's side4.12
doubleside3Triangle's side6

Here's an example of usage:

C#

double trianglePerimeter = Maths.Triangle.GetPerimeter(5.48, 4.12, 6);

VB

Dim trianglePerimeter As Double = Maths.Triangle.GetPerimeter(5.48, 4.12, 6)

Go to top

c. IsBuildable

This function is available in version 1.3 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The IsBuildable() method allows you to know if the specified dimensions can build a triangle. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Triangle.IsBuildable()

This method has three arguments:

ValueArgumentDescriptionExample
doubleside1Triangle's side4.5
doubleside2Triangle's side9.1
doubleside3Triangle's side12.45

Here's an example of usage:

C#

bool isBuildable = Maths.Triangle.IsBuildable(4.5, 9.1, 12.45);

VB

Dim isBuildable As Bool = Maths.Triangle.IsBuildable(4.5, 9.1, 12.45)

Go to top

d. GetHypotenuse

This function is available in version 3.2 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetHypotenuse() method allows you to get a triangle's hypotenuse from the two other sides. (Pythagoras) It returns a double value.

It's in:

LeoCorpLibrary.Maths.Triangle.GetHypotenuse()

This method has two arguments:

ValueArgumentDescriptionExample
doubleside1Triangle's side4.5
doubleside2Triangle's side6.1

Here's an example of usage:

C#

double hypotenuse = Maths.Triangle.GetHypotenuse(4.5, 6.1); // Get the hypotenuse

VB

Dim hypotenuse As Double = Maths.Triangle.GetHypotenuse(4.5, 6.1) ' Get the hypotenuse

Go to top

e. IsRight

This function is available in version 3.10 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The IsRight() method allows you to get if a triangle is right or not. It returns a bool value.

It's in:

LeoCorpLibrary.Maths.Triangle.IsRight()

This method has two arguments:

ValueArgumentDescriptionExample
doubleside1Triangle's side4.5
doubleside2Triangle's side6.1
doubleside3Triangle's side8

Here's an example of usage:

C#

bool isRight = Maths.Triangle.IsRight(3, 4, 5);
// isRight = true

VB

Dim isRight As Boolean = Maths.Triangle.IsRight(3, 4, 5)
' isRight = true

Go to top

Cube

a. GetVolume

This function is available in version 1.8 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetVolume() method allows you to get the volume of a cube.

It's in:

LeoCorpLibrary.Maths.Cube.GetVolume()

This method has two variation:

Variation 1

GetVolume(double side, double height) {...}

Here's the arguments:

ValueArgumentDescriptionExample
doublesideCube's side7.1
doubleheightCube's height3.8

Variation 2

GetVolume(double side) {...}

Here's the arguments:

ValueArgumentDescriptionExample
doublesideCube's side8

Here's an example of usage:

C#

// In the case of a rectangular prism
double volume = Maths.Cube.GetVolume(12, 14);

// In the case of a cube
double volumeCube = Maths.Cube.GetVolume(12);

VB

' In the case of a rectangular prism
Dim volume As Double = Maths.Cube.GetVolume(12, 14)

' In the case of a cube
Dim volumeCube As Double = Maths.Cube.GetVolume(12)

Go to top

b. GetEdge

This function is available in version 1.8.1 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetEdge() method enables you to get the edge of a cube. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Cube.GetEdge()

It has one argument:

ValueArgumentDescriptionExample
doubleareaArea of the cube41.5

Here's an example of usage:

C#

double areaBase = Maths.Cube.GetEdge(31);

VB

Dim areaBase As Double = Maths.Cube.GetEdge(31)

Go to top

Cylinder

a. GetVolume

This function is available in version 1.8 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetVolume() method enables you to get the volume of a cylinder. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Cylinder.GetVolume()

It has two arguments:

ValueArgumentDescriptionExample
doubleradiusCylinder's radius4.5
doubleheightCylinder's height7

Here's an example of usage:

C#

// Get the volume of a cylinder
double volume = Maths.Cylinder.GetVolume(13, 5);

VB

' Get the volume of a cylinder
Dim volume As Double = Maths.Cylinder.GetVolume(13, 5)

Go to top

b. GetHeight

This function is available in version 1.8.1 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetHeight() method enables you to get the height of a cylinder. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Cylinder.GetHeight()

It has two arguments:

ValueArgumentDescriptionExample
doubleradiusCylinder's radius4.5
doubleareaCylinder's area21

Here's an example of usage:

C#

double height = Maths.Cylinder.GetHeight(5, 21);

VB

Dim height As Double = Maths.Cylinder.GetHeight(5, 21)

Go to top

c. GetBaseArea

This function is available in version 1.8.1 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetBaseArea() method allows you to get the area of the base of a cylinder. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Cylinder.GetBaseArea()

It has two arguments:

ValueArgumentDescriptionExample
doubleradiusCylinder's radius12

Here's an example of usage:

C#

double baseArea = Maths.Cylinder.GetBaseArea(10);

VB

Dim baseArea As Double = Maths.Cylinder.GetBaseArea(10)

Go to top

Pyramid

a. GetVolume

This function is available in version 1.8 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetVolume() method allows you to get the volume of a pyramid. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Pyramid.GetVolume()

It has three arguments:

ValueArgumentDescriptionExample
doublelengthLength of the pyramid4.5
doublewidthWidth of the pyramid7
doubleheightHeight of the pyramid8.9

Here's an example of usage:

C#

// Get the volume of a pyramid
double volume = Maths.Pyramid.GetVolume(13, 5, 15);

VB

' Get the volume of a pyramid
Dim volume As Double = Maths.Pyramid.GetVolume(13, 5, 15)

Go to top

b. GetHeight

This function is available in version 1.8.1 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetHeight() method allows you to get the height of a pyramid. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Pyramid.GetHeight()

It has three arguments:

ValueArgumentDescriptionExample
doublelengthLength of the pyramid4.5
doublewidthWidth of the pyramid7
doublevolumeVolume of the pyramid8.9

Here's an example of usage:

C#

double height = Maths.Pyramid.GetHeight(10, 10, 100).

VB

Dim height As Double = Maths.Pyramid.GetHeight(10, 10, 100)

Go to top

c. GetLengthBase

This function is available in version 1.8.1 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetLengthBase() allows you to get the length of the base of a pyramid. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Pyramid.GetLengthBase()

It has two arguments:

ValueArgumentDescriptionExample
doubleareaBaseBase's area9.9
doublewidthWidth12

Here's an example of usage:

C#

double lengthBase = Maths.Pyramid.GetLengthBase(100, 10);

VB

Dim lengthBase As Double = Maths.Pyramid.GetLengthBase(100, 10)

Go to top

d. GetWidthBase

This function is available in version 1.8.1 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetWidthBase() allows you to get the width of the base of a pyramid. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Pyramid.GetWidthBase()

It has two arguments:

ValueArgumentDescriptionExample
doubleareaBaseBase's area6.1
doublelengthLength15

Here's an example of usage:

C#

double widthBase = Maths.Pyramid.GetWidthBase(100, 10);

VB

Dim widthBase As Double = Maths.Pyramid.GetWidthBase(100, 10)

Go to top

Hexagon

a. GetArea

This function is available in version 3.2 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetArea() method allows you to get the area of an hexagon from the length of it's side. It returns a double value.

It's in:

LeoCorpLibrary.Maths.Hexagon.GetArea()

It has one argument:

ValueArgumentDescriptionExample
doublesideLength of the hexagon's side8

Here's an example of usage:

C#

double hexagonArea = Maths.Hexagon.GetArea(8); // Get the area

VB

Dim hexagonArea As Double = Maths.Hexagon.GetArea(8) ' Get the area

Go to top

b. GetPerimeter

This function is available in version 3.2 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetPerimeter() method allows you to get the perimeter of a hexagon. It returns a double value.

It's in:

LeoCorpLibrary.Maths.Hexagon.GetPerimeter()

It has one argument:

ValueArgumentDescriptionExample
doublesideLength of the hexagon's side7.2

Here's an example of usage:

C#

double hexagonPerimeter = Maths.Hexagon.GetPerimeter(7.2); // Get perimeter

VB

Dim hexagonPerimeter As Double = Maths.Hexagon.GetPerimeter(7.2) ' Get perimeter

Go to top

Diamond

a. GetArea

This function is available in version 3.2 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetArea() method allows you to get the area of a diamond. It returns a double value.

It's in:

LeoCorpLibrary.Maths.Diamond.GetArea()

It has one argument:

ValueArgumentDescriptionExample
doublediag1Length of the diamond's diagonal4.5
doublediag2Length of the diamond's diagonal7.5

Here's an example of usage:

C#

double diamondArea = Maths.Diamond.GetArea(4.5, 7.5); // Get area

VB

Dim diamondArea As Double = Maths.Diamond.GetArea(4.5, 7.5) ' Get area

Go to top

b. GetPerimeter

This function is available in version 3.2 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetPerimeter() method allows you to get the area of a diamond. It returns a double value.

It's in:

LeoCorpLibrary.Maths.Diamond.GetPerimeter()

It has one argument:

ValueArgumentDescriptionExample
doublesideLength of the diamond's side8

Here's an example of usage:

C#

double diamondPerimeter = Maths.Diamond.GetPerimeter(8); // Get perimeter

VB

Dim diamondPerimeter As Double = Maths.Diamond.GetPerimeter(8) ' Get perimeter

Go to top

Sphere

a. GetArea

This function is available in version 3.8 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetArea() method allows you to get the area of a sphere from its radius. It returns a double value.

It's in:

LeoCorpLibrary.Maths.Sphere.GetArea()

It has one argument:

ValueArgumentDescriptionExample
doubleradiusRadius of the sphere10

Here's an example of usage:

C#

double area = Maths.Sphere.GetArea(10);
// Expected output:
// 1256.6370614359173

VB

Dim area As Double = Maths.Sphere.GetArea(10)
' Expected output:
' 1256.6370614359173

Go to top

b. GetVolume

This function is available in version 3.8 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetVolume() method allows you to get the volume of a sphere from its radius. It returns a double value.

It's in:

LeoCorpLibrary.Maths.Sphere.GetVolume()

It has one argument:

ValueArgumentDescriptionExample
doubleradiusRadius of the sphere10

Here's an example of usage:

C#

double volume = Maths.Sphere.GetVolume(10);
// Expected output:
// 4188.790204786391

VB

Dim volume As Double = Maths.Sphere.GetVolume(10)
' Expected output:
' 4188.790204786391

Go to top

Cone

a. GetVolume

This function is available in version 3.10 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetVolume() method allows you to get the volume of a cone. It returns a double value.

It's in:

LeoCorpLibrary.Maths.Cone.GetVolume()

This method has two arguments:

ValueArgumentDescriptionExample
doubleradiusThe radius of the cone10.4
doubleheightThe height of the cone9.5

Here's an example of usage:

C#

double volume = Maths.Cone.GetVolume(5, 20);
// volume = 523.5987755982989

VB

Dim volume As Double = Maths.Cone.GetVolume(5, 20)
' volume = 523.5987755982989

Go to top

Trigonometry functions

SohCahToa

a. GetTriangleOpposedSideFromHypotenuse

This function is available in version 3.5 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetTriangleOpposedSideFromHypotenuse() allows you to get a triangle's opposed side from an angle, and its hypotenuse. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Trigonometry.GetTriangleOpposedSideFromHypotenuse()

It has one argument:

ValueArgumentDescriptionExample
doubleangleThe angle value (in radians)1.2
doublehypotenuseThe hypotenuse length value12

Here's an example of usage:

Image

C#

double opposedSide = Maths.Trigonometry.GetTriangleOpposedSideFromHypotenuse(1.05, 10);
// Expected result: 8.66
// Actual result: 8.67423225594017

VB

Dim opposedSide As Double = Maths.Trigonometry.GetTriangleOpposedSideFromHypotenuse(1.05, 10)
' Expected result: 8.66
' Actual result: 8.67423225594017

Go to top

b. GetTriangleOpposedSideFromAdjacent

This function is available in version 3.5 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetTriangleOpposedSideFromAdjacent() method allows you to get a triangle's opposed side from an angle, and its adjacent side. It returns a double value.

It's in:

LeoCorpLibrary.Maths.Trigonometry.GetTriangleOpposedSideFromAdjacent()

It has one argument:

ValueArgumentDescriptionExample
doubleangleThe angle value (in radians)1.02
doubleadjacentThe adjacent side length value5

Here's an example of usage:

Image

C#

double opposedSide = Maths.Trigonometry.GetTriangleOpposedSideFromAdjacent(1.05, 5);
// Expected result: 8.66
// Actual result: 8.716576549915851

VB

Dim opposedSide As Double = Maths.Trigonometry.GetTriangleOpposedSideFromAdjacent(1.05, 5)
' Expected result: 8.66
' Actual result: 8.716576549915851

Go to top

c. GetTriangleAdjacentSideFromHypotenuse

This function is available in version 3.5 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetTriangleAdjacentSideFromHypotenuse() method allows you to get a triangle's adjacent side from an angle, and its hypotenuse. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Trigonometry.GetTriangleAdjacentSideFromHypotenuse()

It has one argument:

ValueArgumentDescriptionExample
doubleangleThe angle value (in radians)1.02
doublehypotenuseThe hypotenuse side length value5

Here's an example of usage:

Image

C#

double adjacentSide = Maths.Trigonometry.GetTriangleAdjacentSideFromHypotenuse(1.05, 10);
// Expected result: 5
// Actual result: 4.97571047891727

VB

Dim opposedSide As Double = Maths.Trigonometry.GetTriangleAdjacentSideFromHypotenuse(1.05, 10)
' Expected result: 5
' Actual result: 4.97571047891727

Go to top

d. GetTriangleAdjacentSideFromOpposedSide

This function is available in version 3.5 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetTriangleAdjacentSideFromOpposedSide() method allows you to get a triangle's adjacent side from an angle, and its opposed side. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Trigonometry.GetTriangleAdjacentSideFromOpposedSide()

It has one argument:

ValueArgumentDescriptionExample
doubleangleThe angle value (in radians)1.2
doubleopposedThe opposed side length value8.6

Here's an example of usage:

Image

C#

double adjacentSide = Maths.Trigonometry.GetTriangleAdjacentSideFromOpposedSide(1.05, 8.66);
// Expected result: 5
// Actual result: 4.967546576576329

VB

Dim adjacentSide As Double = Maths.Trigonometry.GetTriangleAdjacentSideFromOpposedSide(1.05, 8.66)
' Expected result: 5
' Actual result: 4.967546576576329

Go to top

e. GetTriangleHypotenuseFromOpposedSide

This function is available in version 3.5 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetTriangleHypotenuseFromOpposedSide() method allows you to get a triangle's hypotenuse from an angle, and its opposed side. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Trigonometry.GetTriangleHypotenuseFromOpposedSide()

It has one argument:

ValueArgumentDescriptionExample
doubleangleThe angle value (in radians)1.2
doubleopposedThe opposed side length value8.6

Here's an example of usage:

Image

C#

double hypotenuse = Maths.Trigonometry.GetTriangleHypotenuseFromOpposedSide(1.05, 8.66);
// Expected result: 10
// Actual result: 9.98359248920223

VB

Dim hypotenuse As Double = Maths.Trigonometry.GetTriangleHypotenuseFromOpposedSide(1.05, 8.66)
' Expected result: 10
' Actual result: 9.98359248920223

Go to top

f. GetTriangleHypotenuseFromAdjacentSide

This function is available in version 3.5 and higher

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetTriangleHypotenuseFromAdjacentSide() method allows you to get a triangle's hypotenuse from an angle, and its adjacent side. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Trigonometry.GetTriangleHypotenuseFromAdjacentSide()

It has one argument:

ValueArgumentDescriptionExample
doubleangleThe angle value (in radians)1.2
doubleadjacentThe adjacent side length value8.6

Here's an example of usage:

Image

C#

double hypotenuse = Maths.Trigonometry.GetTriangleHypotenuseFromAdjacentSide(1.05, 5);
// Expected result: 10
// Actual result: 10.04881618652381

VB

Dim hypotenuse As Double = Maths.Trigonometry.GetTriangleHypotenuseFromAdjacentSide(1.05, 5)
' Expected result: 10
' Actual result: 10.04881618652381

Go to top

Percentage

a. GetResultPercentageIncrease

This function is available in version 4.7 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetResultPercentageIncrease() method allows you to get the result after a percentage increase. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Percentage.GetResultPercentageIncrease()

This method has two arguments:

ValueArgumentDescriptionExample
doublevalueThe base value100
doubleincreaseRateThe evolution rate, in the following format: x/100d50/100d or 0.5

Here's an example of usage:

C#

double result = Maths.Percentage.GetResultPercentageIncrease(100, 50/100d);
// Expected result: 150
// Actual result: 150.0

VB

Dim result As Double = Maths.Percentage.GetResultPercentageIncrease(100, 50/100d)
' Expected result: 150
' Actual result: 150.0

Go to top

b. GetResultPercentageDecrease

This function is available in version 4.7 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetResultPercentageDecrease() method allows you to get the result after a percentage decrease. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Percentage.GetResultPercentageDecrease()

This method has two arguments:

ValueArgumentDescriptionExample
doublevalueThe base value100
doubledecreaseRateThe evolution rate, in the following format: x/100d50/100d or 0.5

Here's an example of usage:

C#

double result = Maths.Percentage.GetResultPercentageDecrease(100, 50/100d);
// Expected result: 50
// Actual result: 50.0

VB

Dim result As Double = Maths.Percentage.GetResultPercentageDecrease(100, 50/100d)
' Expected result: 50
' Actual result: 50.0

Go to top

c. GetInvertedEvolutionRate

This function is available in version 4.7 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The GetInvertedEvolutionRate() method allows you to get the inverted evolution rate that cancels itself. Returns a double value.

It's in:

LeoCorpLibrary.Maths.Percentage.GetInvertedEvolutionRate()

It has one argument:

ValueArgumentDescriptionExample
doubleevolutionRateThe evolution rate, in the following format: x/100d20/100d or 0.2

Here's an example of usage:

C#

double result = Maths.Percentage.GetInvertedEvolutionRate(20/100d);
// Expected result: -0.16666666666666663

VB

Dim result As Double = Maths.Percentage.GetInvertedEvolutionRate(20/100d)
' Expected result: -0.16666666666666663

Go to top

d. ProportionToPercentageString

This function is available in version 4.7 and higher.

Compatibility
FrameworksLeoCorpLibraryLeoCorpLibrary.Core
.NET 6
.NET 5
.NET Core 3.1
.NET Framework 4.5

The ProportionToPercentageString() method allows you to get the percentage string from a proportion. Returns a string value.

It's in:

LeoCorpLibrary.Maths.Percentage.ProportionToPercentageString()

It has one argument:

ValueArgumentDescriptionExample
doubleproportionThe proportion to get the string of0.2

Here's an example of usage:

C#

string result = Maths.Percentage.ProportionToPercentageString(0.2);
// Expected result: "20%"

VB

Dim result As String = Maths.Percentage.ProportionToPercentageString(0.2)
' Expected result: "20%"

Go to top