Difference between revisions of "TPADensity"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function TPADensity(const TPA: TPointArray): Extended; </source> ===Source Code=== <source lang="scar"> function TPADensity(con...")
 
(Example)
 
(2 intermediate revisions by the same user not shown)
Line 8: Line 8:
 
function TPADensity(const TPA: TPointArray): Extended;
 
function TPADensity(const TPA: TPointArray): Extended;
 
begin
 
begin
   Result := MyTPAArea(TPA) / Length(TPA);
+
   Result := Length(TPA) / TPAArea(TPA);
 
end;
 
end;
 
</source>
 
</source>
Line 14: Line 14:
 
==Availability==
 
==Availability==
 
SCAR Divi 3.26 > Current
 
SCAR Divi 3.26 > Current
 +
 +
*For SCAR Divi 3.31 and older, this function was bugged, if you're using those versions, please use the source code above.
  
 
==Description==
 
==Description==
Line 26: Line 28:
  
 
Output:
 
Output:
  10
+
  0,1
  
 
==See Also==
 
==See Also==

Latest revision as of 23:54, 11 March 2012

Definition

function TPADensity(const TPA: TPointArray): Extended;

Source Code

function TPADensity(const TPA: TPointArray): Extended;
begin
  Result := Length(TPA) / TPAArea(TPA);
end;

Availability

SCAR Divi 3.26 > Current

  • For SCAR Divi 3.31 and older, this function was bugged, if you're using those versions, please use the source code above.

Description

Calculates the density of a given TPointArray TPA.

Example

begin
  WriteLn(TPADensity([Point(0, 0), Point(1, 2), Point(5, 4)]));
end.

Output:

0,1

See Also