Difference between revisions of "TPAArea"

From SCAR Divi Manual
Jump to: navigation, search
Line 1: Line 1:
 
==Definition==
 
==Definition==
 
<source lang="scar" lines="false">
 
<source lang="scar" lines="false">
function TPAArea(const TPA: TPointArray): Integer;
+
function TPAInTPA(const TPA1, TPA2: TPointArray): Boolean;
</source>
 
 
 
===Source Code===
 
<source lang="scar">
 
function TPAArea(const TPA: TPointArray): Integer;
 
var
 
  w, h: Integer;
 
begin
 
  TPADimensions(TPA, w, h);
 
  Result := w * h;
 
end;
 
 
</source>
 
</source>
  
 
==Availability==
 
==Availability==
SCAR Divi 3.26 > Current
+
SCAR Divi 3.20 > Current
  
 
==Description==
 
==Description==
Returns the size of the area covered by a given [[TPointArray]] '''TPA'''.
+
Returns [[true]] if all points in '''TPA1''' are also part of '''TPA2'''. The function does not take into account duplicates.
  
 
==Example==
 
==Example==
 
<source lang="scar">
 
<source lang="scar">
 
begin
 
begin
   WriteLn(TPAArea([Point(0, 0), Point(1, 2), Point(5, 4)]));
+
   WriteLn(TPAInTPA([Point(0, 0), Point(1, 2), Point(5, 6)],
 +
    [Point(-5, 2), Point(0, 0), Point(1, 2), Point(5, 6), Point(1, 3)]));
 +
  WriteLn(TPAInTPA([Point(0, 0), Point(1, 2), Point(5, 6)],
 +
    [Point(-5, 2), Point(1, 2), Point(5, 6), Point(1, 3)]));
 
end.
 
end.
 
</source>
 
</source>
  
 
Output:
 
Output:
  30
+
  1
 +
0
  
 
==See Also==
 
==See Also==
*[[TPADensity]]
+
*[[TPAContains]]
*[[TPADimensions]]
 
*[[TPABounds]]
 
  
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:TPA Functions]]
 
[[Category:TPA Functions]]
 
[[Category:Array Functions]]
 
[[Category:Array Functions]]

Revision as of 14:57, 3 July 2011

Definition

function TPAInTPA(const TPA1, TPA2: TPointArray): Boolean;

Availability

SCAR Divi 3.20 > Current

Description

Returns true if all points in TPA1 are also part of TPA2. The function does not take into account duplicates.

Example

begin
  WriteLn(TPAInTPA([Point(0, 0), Point(1, 2), Point(5, 6)],
    [Point(-5, 2), Point(0, 0), Point(1, 2), Point(5, 6), Point(1, 3)]));
  WriteLn(TPAInTPA([Point(0, 0), Point(1, 2), Point(5, 6)],
    [Point(-5, 2), Point(1, 2), Point(5, 6), Point(1, 3)]));
end.

Output:

1
0

See Also