General geometry: sides and angles
This group contains functions that do not belong specifically to the area, volume, or circumference categories.

The first function in this group is the diagonal of rectangle. This is also a triangle function - where we use good old phytagoras formula for calculating the hypotenuse from the length of the catheters.
diagonalRect(x; y )
Where
x= length of first sidey= length of second side
Using the following formula:
Example:
Diagonal of a rectangle that is 90 cm wide, and 50 cm high:
diagonalRect(50;90)=102.9563014
*The next one is the angle between the diagonal and the baseline of the rectangle. *
diagonalAngle(x; y )
Where
x= width of rectangley= height of rectangle
Using the following formula:
Example:
A 20 cm wide rectangle, 15 cm height have a diagonal. What is the angle of that diagonal?
diagonalAngle(20;15)=36.86989765
Next is the height of a triangle from the lengths of its three sides. It uses Heron's formula to calculate the area and then derives the height relative to the selected base.
TriangleHeight(x; y; z )
Where
x= length of basey= length of second sidez= length of third side
Using the following formulas:
Example:
TriangleHeight(20;12;15)=8.966569855
The next formula up, is calculating the golden section of a line. That is, for a line "C", that is split into two pieces "A" and "B", If the proportion of A to C, is the same as B to A, then we have a golden section. This function finds the length of the part A. Subtracting it from C, will of course give us part B.
GoldenSectionA(x )
Where
x= length of line A+B
Using the following formula:
Example: For a 20 cm long line, what is the golden section A?
GoldenSectionA(20)=12.36067978
*Now, we move over to regular polygons, inscribed circles and circumcircle. *
Definitions:
Regular polygon: a polygon whose sides have equal length and whose interior angles have equal size.
Circumcircle: a circle centred on the polygon that passes through all its vertices.
Inscribed circle: a circle centred on the polygon that touches every side.
The circumradius is the distance from the centre to a vertex. The inradius is the perpendicular distance from the centre to a side.
First function here is Inscribed Circle diameter to CircumCircle Diameter:
polyDiaIC2CC(x; y )
Where
x= number of sidesy= diameter of Inscribed Circle
Using the following formula:
The sum of the interior angles of a regular polygon is 180*(n-2), where n is the number of sides. Half of one interior angle is 90*(n-2)/n; the function uses its sine to relate the inscribed and circumscribed circles.
Example:
A nut (Hexagon) is 20mm between the sides (as you use a 20mm fixed spanner on it) - what is the diameter around the edges ?
polyDiaIC2CC(6;20)=23.09401077 mm
The inverse function calculates the inscribed-circle diameter from the circumcircle:
polyDiaCC2IC(x; y )
Where
x= number of cornersy= diameter of Circumcircle
Using the following formula:
Example:
Let us see what the distance between the sides of the nut are, if we know the diameter around the edges:
polyDiaCC2IC(6;23.09401077)=20
The next function give us the interior angle of a regular polygon.
angleRegPolygon(x )
Where
x= Number of sides
Using the following formula:
Example:
What is the interior angle of a hexagon ?
angleRegPolygon(6)=120
Now, we head into the realm of regular star polygons. Regular star polygons, you get if you extends the line of the sides of a regular polygon, to they intersect. A pentagram is an example of a regular star polygon. It is not any star shaped regular polygon, as the rectangles around has to be adjasent with the sides of the "inner polygon". If you stretch the triangles, it might be symetrical, but not regular.
The inscribed circle touches the inner edges of the star polygon, while the circumcircle touches its outer points.
First we go from Inscribed Circle to CircumCircle:
polyStarDiaIC2CC(x; y ) - Regular star polygon diameters: Inscribed Circle to Circumcircle
Where
x= number of sidesy= diameter of Inscribed Circle
Using the following formulas:
Example:
The inner diameter of the star polygon is 15 cm. What is the outer diameter?
polyStarDiaIC2CC(5;15)=39.27050984
The inverse function is:
polyStarDiaCC2IC(x; y ) - Regular star polygon diameters: Circumcircle to Inscribed Circle
Where
x= number of sidesy= diameter of Circumcircle
Using the following formulas:
Quadratic equations
The library also includes functions for both roots of ax^2+bx+c=0.
QuadraticPlus(x; y; z )
QuadraticMinus(x; y; z )
Example:
If we calculate the opposite value from the previous function:
polyStarDiaCC2IC(5;39.27050984)=15
This was the last one in this series. There are more geometric functions if you head into the area of object section.
RELATED TOPICS
