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

right triangle

Computes the area of a trapezium within a right angled triangle with a fixed edge.
Controller: CodeCogs

C++
Excel

Right Triangle

 doubleright_triangle( double a double b double c double h )[inline]
This module computes the area of the trapezium formed between a right angled triangle with a fixed edge on a reference line and a line found at a given distance distance from this reference line.

This situation is described by the following image. The area which we want to compute is that of the filled trapezium $\inline&space;&space;[BB_1C_1C]$.

Solution

Let $\inline&space;&space;\mathrm{xOy}$ be an orthogonal coordinate system and let $\inline&space;&space;\triangle&space;ABC$ be a right angled triangle ($\inline&space;&space;\angle&space;C&space;=&space;90^{\circ}$) so that $\inline&space;&space;BC&space;\subset&space;\mathrm{Ox}$ and
$BC&space;=&space;a&space;\qquad&space;AC&space;=&space;b&space;\qquad&space;AB&space;=&space;c$
where $\inline&space;&space;a,&space;b,&space;c&space;\in&space;\mathbb{R}_+^*$ are fixed numbers. Also let $\inline&space;&space;d&space;\parallel&space;\mathrm{Ox}$ so that the distance from line $\inline&space;&space;d$ to $\inline&space;&space;\mathrm{Ox}$ is $\inline&space;&space;h&space;\in&space;\mathbb{R}_+$ and $\inline&space;&space;AB&space;\cap&space;d&space;=&space;\{B_1\}$, $\inline&space;&space;AC&space;\cap&space;d&space;=&space;\{C_1\}$.

Obviously $\inline&space;&space;\triangle&space;AB_1C_1&space;&space;\sim&space;\triangle&space;ABC$, which implies:
$\frac{B_1C_1}{BC}&space;=&space;\frac{b-h}{b}&space;\qquad&space;\Rightarrow&space;\qquad&space;B_1C_1&space;=&space;a\frac{b-h}{B}$
Thus:
$\mathcal{A}_{[BB_1C_1C]}&space;=&space;(BC&space;+&space;B_1C_1)\frac{h}{2}&space;=&space;\frac{ah}{2}\left(&space;2&space;-&space;\frac{h}{b}&space;\right)$
To conclude, the solution of the problem is:
$\mathcal{A}_{[BB_1C_1C]}&space;=&space;ah&space;-&space;\frac{ah^2}{2b}$

Example 1

#include <codecogs/geometry/area/right_triangle.h>
#include <stdio.h>

int main()
{
// the lengths of the sides
double a = 3.0, b = 4.0, c = 5.0;

// display the lengths of the sides
printf("a = %.1lf\nb = %.1lf\nc = %.1lf\n\n", a, b, c);

// display the area for different values of h
for (double h = 0.1; h < 1.09; h += 0.1)
printf("h = %.1lf   Area = %.2lf\n", h, Geometry::Area::right_triangle(a, b, c, h));

return 0;
}

Output

a = 3.0
b = 4.0
c = 5.0

h = 0.1   Area = 0.30
h = 0.2   Area = 0.59
h = 0.3   Area = 0.87
h = 0.4   Area = 1.14
h = 0.5   Area = 1.41
h = 0.6   Area = 1.66
h = 0.7   Area = 1.92
h = 0.8   Area = 2.16
h = 0.9   Area = 2.40
h = 1.0   Area = 2.62

Note

The values of the sides must be Pythagorean numbers, i.e. satisfying the equality:
$a^2&space;+&space;b^2&space;=&space;c^2.$

Parameters

 a first side of the triangle (BC) b second side of the triangle (AC) c third side of the triangle (AB) h the distance between line $\inline&space;&space;d$ and $\inline&space;&space;\mathrm{Ox}$

Returns

The value of the desired area.

Authors

Eduard Bentea (September 2006)
Source Code

Source code is available when you buy a Commercial licence.

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