FUNCTION
free_triangle
Computes the area of a triangle or a trapezium within a triangle with a fixed vertex.
Interface
#include <codecogs/maths/geometry/area/free_triangle.h>
using namespace Maths::Geometry::Area;
This module computes the area of the triangle or trapezium formed between a triangle with a fixed vertex on a reference line and a line found at a given distance distance from this reference line.
The various cases are described by the images given in the following documentation, where the area which we want to compute is that of the filled shape.
Solution
Let be an orthogonal coordinate system and let
be an arbitrary triangle so that
and
where are fixed numbers.
Consider and
so that the distance between the line d and
equals
. Also let
and
.
We will first find the lengths of the projections of B and C on because we can separate different cases based on these values. Let
and
. Since these values are independent of the relations set between them and h we can consider, without loss of generality, the following case:
and
.

Let S be the area which we must determine. Based on the values of ,
and
, we find the following solutions:
1) ,

2) ,

3) ,

4) ,

Output:
a = 2.613
b = 1.878
c = 1.209
alpha = 0.61086
h = 0.0 Area = 0.00
h = 0.3 Area = 0.14
h = 0.6 Area = 0.56
h = 0.9 Area = 0.97
h = 1.2 Area = 1.04
h = 1.5 Area = 1.04
Example 1
#include <codecogs/maths/geometry/area/free_triangle.h>
#include <stdio.h>
int main()
{
// the lengths of the sides
double a = 2.613, b = 1.878, c = 1.209;
// the value of the alpha angle in radians
double alpha = 0.61086;
// display the lenghts of the sides and the alpha angle
printf("a = %.3lf\nb = %.3lf\nc = %.3lf\nalpha = %.5lf \n\n", a, b, c, alpha);
// display the area for different values of h
for (double h = 0.0; h < 1.6; h += 0.3)
printf("h = %.1lf Area = %.2lf\n", h,
Geometry::Area::free_triangle(a, b, c, h, alpha));
return 0;
}Parameters
Returns
The vertices must be denoted such that the abscissa of is less than that of
, i.e. as in the given examples.
Interactive Calculator
Computing…
Set a range above first to export a graph.