CT Array to polygon

4D - Documentation   Français   English   German   4D Chart, Command Theme List   4D Chart, Command Alphabetical List   Back   Previous   Next

version 1


CT Array to polygon (area; arrayH; arrayV) Longint

ParameterTypeDescription
areaLongint4D Chart area
arrayHReal arrayArray of horizontal values for vertices
arrayVReal arrayArray of vertical values for vertices
Function resultLongintThe new object's Object ID

Description

CT Array to polygon creates a new polygon in area based on the arrays arrayH and arrayV and returns the new object's ID.

arrayH and arrayV describe the position of each vertex of the polygon. The two arrays can be of type Real, Long Integer, or Integer, and are specified in points. Each array must have at least three elements for the polygon to be successfully created. If the arrays are not the same size, the extra elements in the larger array are ignored. To create a closed polygon, the last value in each array must match the first value.

Example

This example fills two arrays and creates a polygon from them. It then moves and resizes the polygon:

   $Vertices:=Num (Request ("Enter number of vertices:"))
   If (OK=1)  `Declare the arrays
      ARRAY REAL (aVerticeH;$Vertices)
      ARRAY REAL (aVerticeV;$Vertices)
      For ($i;1;$Vertices)   `Fill the arrays
         aVerticeH{$i}:=Sin($i)
         aVerticeV{$i}:=Cos($i)
      End for 
         `Draw the polygon
      $Poly:= CT Array to polygon (Area;aVerticeH;aVerticeV)
         `Move the polygon to the area cordinates (10,10)
      CT MOVE (Area;$Poly;10;10)
      CT SIZE (Area;$Poly;200;200)  `Resize the polygon to 200x200
   End if 

4D - Documentation   Français   English   German   4D Chart, Command Theme List   4D Chart, Command Alphabetical List   Back   Previous   Next