InTriangle

From SCAR Divi Manual
Revision as of 22:09, 20 October 2011 by Freddy (talk | contribs)
Jump to: navigation, search

Definition

function InTriangle(const x, y, x1, y1, x2, y2, x3, y3: Integer): Boolean;

Availability

SCAR Divi 3.00 > Current

Description

This function determines whether a coordinate specified by (x, y) can be found inside of the triangle specified by the points (x1, y1), (x2, y2) and (x3, y3). If the coordinate is outside or on top of the triangle, False is returned.

Example

begin
  if InTriangle(2, 2, 1, 1, 0, 3, 6, 3) then
    WriteLn('The point can be found in the triangle')
  else
    WriteLn('The point is outside or on top of the triangle');
end.

Output:

The point can be found in the triangle

See Also