• https://me.yahoo.com
COST (GBP)
2.74
0.00
0

pythgen

Pythagoras Generalized Theorem implementation
Controller: lariev

C++

Overview

The aim of this module is to implement Pythagoras Generalized Theorem. Given any triangle knowing the value of two sides and the angle between them, one can find out the value of the third side.

According to Pythagora's Generalized Theorem the value of AC side is:
$\textit{AC}&space;=&space;\sqrt{\textit{AB}^2&space;+&space;\textit{BC}^2&space;-&space;2&space;\cdot&space;&space;\textit{AB}&space;\cdot&space;\textit{BC}&space;\cdot&space;\cos(\widehat{\textit{ABC}})&space;}$

This can easily be proven using normal Pythagoras Theorem in the ADC triangle:
$\textit{AC}^2&space;=&space;\texit{AD}^2&space;+&space;\textit{DC}^2$
However,
$\sin{\beta}&space;=&space;\frac{\textit{AD}}{\texit{AB}}$
and
$\cos{\beta}&space;=&space;\frac{\textit{BD}}{\texit{AB}}$

Thus, using the last three equations:
$\texit{AC}^2&space;=&space;\sin^2{\beta}&space;\cdot&space;\texit{AB}^2&space;+&space;\cos^2{\beta}&space;\cdot&space;\textit{AB}&space;+&space;(\texit{BC}&space;-&space;\texit{BD})^2$
which is
$\texit{AC}^2&space;=&space;\texit{AB}^2&space;+\texit{BC}^2&space;-&space;2&space;\cdot&space;\texit{AB}&space;\cdot&space;\texit{BC}&space;\cdot&space;\cos{\beta}$

Example 1

#include <stdio.h>
#include <codecogs/maths/geometry/pythgen.h>

int main()
{
//an equal-sided triangle with the side value of 3.5
double thirdSide = pythgen_PythagorasGen(3.5,3.5,60);

printf("\nThe value of the 3rd side: %.2lf", thirdSide);

return 0;
}

Output

The value of the 3rd side: 3.50

Parameters

 alpha value of angle measured in degrees

Returns

value of angle measured in radians

Authors

Victor Larie (May 2010)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.

Pythgen PythagorasGen

 doublepythgen_PythagorasGen( const double x const double y const double alpha )

Parameters

 x the value of one side of the triangle y the value of another side of the triangle alpha the value of the angle between the sides given in degrees

Returns

the value of the third side of the triangle

Authors

Victor Larie (May 2010)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.