Home › Forums › Problems and solutions in GDL › GDL add-ons › Polygon Operations Extension › Reply To: Polygon Operations Extension
What i am looking for exactly is this:
I have a given Array of x and y – a closed polygone in the form of:
x[points] and y[points] and the number of points in the Array in an extra integer named “points”.
I want to get a second polygone – with an inner offset to the original one.
As far as i understand the GDL-handbook, i first have to open a channel with the code:
kanal = INITADDONSCOPE ("PolyOperations ", "", "")
Then i have to prepare my source and Target – Polygones:
! --- QUELL- + ZIELCONTAINER ERZEUGEN
PREPAREFUNCTION kanal, "CreateContainer", "Eingang", ""
PREPAREFUNCTION kanal, "SetSourceContainer", "Eingang", ""
PREPAREFUNCTION kanal, "CreateContainer", "Ergebnis", ""
PREPAREFUNCTION kanal, "SetDestinationContainer", "Ergebnis", ""
after this, i have to give my extra stored coordinates into one array:
for oft = 1 to points
arrayname[oft][1] = x[oft]
arrayname[oft][2] = y[oft]
arrayname[oft][3] = 0 !! angle?
nZug=nZug+1 : zug[nZug]=oft
next oft
Then i have to give the array to the function:
PREPAREFUNCTION kanal, "Store", "Polygon", points, 1, arrayname, zug (contourArray)
i have difficulties to understand this:
contourArray: An array which contains the index of the last vertex of the i-th contour. It must have exactly nContours items.
Therefor i would need an Example how to to this correctly!
Then i have to “init” the calculation with: ?? or how exactly?
dim resPolyIDArray[]
nPgon = CALLFUNCTION (Kanal, "OffsetEdge", "Polygon", resPolyIDArray)
Then i have to read out the resulting array:
nPgon = CALLFUNCTION (Kanal, "GetDestinationPolygons", "", resPolyIDArray)
after this i can close it:
CLOSEADDONSCOPE (Kanal)
Then i can use put and get for an Poly2-Command to draw the polygone. Im i Right so far? There are a lot of possible mistakes i can make with this very complex command…
Teacher in HTL-Salzburg
AC5-19, Win and Mac
GDL hobby developer