Computes the area of a trapezium within a triangle with a fixed edge.

You're viewing an older version of this page (#394). View the current version.

View versions (1)

Interface

#include <codecogs/maths/geometry/area/edge_triangle.h>

using namespace Maths::Geometry::Area;

This module computes the area of the trapezium formed between a 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 [BB_1C_1C].

1/edge_triangle-746.jpg

Solution

Let \mathrm{xOy} be an orthogonal coordinate system and let \triangle ABC be an arbitrary triangle so that BC \subset \mathrm{Ox} and

BC = a \qquad AC = b \qquad AB = c
(1)

where a, b, c \in \mathbb{R}_+^* are fixed numbers. Also let d  \parallel \mathrm{Ox} so that the distance between the line d and \mathrm{Ox} equals h \in \mathbb{R}_+ and AB \cap d = \{B_1\}, AC \cap d = \{C_1\}.

Obviously \triangle AB_1C_1 \sim \triangle ABC which implies:

\frac{B_1C_1}{BC} = \frac{H - h}{H} \qquad \Rightarrow \qquad B_1C_1 = a \left( 1 - \frac{h}{H} \right )
(2)

where H is the height corresponding to vertex A.

This part is only visible to registered users. Sign in to see it.

Example 1

#include <codecogs/maths/geometry/area/edge_triangle.h>
#include <stdio.h>

int main()
{
  // the lengths of the sides
  double a = 3.3, b = 4.5, c = 5.4;

  // 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::edge_triangle(a, b, c, h));

  return 0;
}

Output:

a = 3.3
b = 4.5
c = 5.4

h = 0.1   Area = 0.33
h = 0.2   Area = 0.65
h = 0.3   Area = 0.96
h = 0.4   Area = 1.26
h = 0.5   Area = 1.56
h = 0.6   Area = 1.85
h = 0.7   Area = 2.13
h = 0.8   Area = 2.40
h = 0.9   Area = 2.67
h = 1.0   Area = 2.93

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 d and \mathrm{Ox}

Returns

The value of the desired area.

The values of the sides must satisfy the triangle inequality.

GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

a
b
c
h
Result