.BusinessSimulation.Functions.areaLineSegment

Information

This information is part of the Business Simulation Library (BSL). Please support this work and ► donate.

The output y is the area under a line given by two points p1, p2 which are assumed to be either both above or both below the abscissa, i.e., the ordinates of the points have the same sign.

Syntax

Functions.areaLineSegment(p1, p2);

Implementation


y := abs((p2[1] - p1[1]) * (p1[2] + p2[2]) / 2);

Examples


areaLineSegment({1,1},{2,1}); // 1.0
areaLineSegment({1,1},{2,2}); // 1.5

Interface

encapsulated function areaLineSegment
  import BusinessSimulation.Icons.Function;
  extends Function;
  input Real[2] p1, p2 "Points whose ordinates have the same sign";
  output Real y "Area between the abscissa and the line within the closed interval [p1[1], p2[1]]";
end areaLineSegment;

Revisions


Generated at 2024-04-28T18:16:21Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos