{"name":"drawPolygon","title":"drawPolygon","type":"command","url":"https://community.bistudio.com/wiki/drawPolygon","revid":377843,"updated":"2026-01-03T04:35:45Z","groups":["GUI Control - Map"],"status":"ok","games":{"arma3":"1.58"},"since":"arma3 1.58","arma3_since":"1.58","description":"Draws given polygon on the given map control with given color. The polygon must consist of at least 3 points. Unlike with other `draw*` commands and due to complexity, this command does not support filling of the polygon with color. Use drawTriangle command to construct and fill polygon shape as a workaround.","syntaxes":[{"syntax":"map drawPolygon [polygon, color]","params":[{"name":"map","type":"Control","type_expr":"Control"},{"name":"polygon","type":"Array of Position3D","type_expr":"Array<Position3D>"},{"name":"color","type":"Color (RGBA)","type_expr":"Color"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"map"},"right":{"text":"[polygon, color]"}}],"examples":[{"text":"```sqf\ntest_polygon = [];\nfor \"_i\" from 1 to 12 do\n{\n    test_polygon pushBack (player getPos [10 + random 100, 360 / _i]);\n};\n\nfindDisplay 12 displayCtrl 51 ctrlAddEventHandler [\"Draw\",\n{\n    params [\"_control\"];\n    _control drawPolygon [test_polygon, [0,0,1,1]];\n}];\n```","code":["test_polygon = [];\nfor \"_i\" from 1 to 12 do \n{\n\ttest_polygon pushBack (player getPos [10 + random 100, 360 / _i]);\n};\n\nfindDisplay 12 displayCtrl 51 ctrlAddEventHandler [\"Draw\", \n{\n\tparams [\"_control\"];\n\t_control drawPolygon [test_polygon, [0,0,1,1]];\n}];"]},{"text":"Draw a polygon by adjusting the `_radius` and `_numVertices`\n\n```sqf\nvertices = [];\nprivate _numVertices = 2;\nprivate _numVertices = _numVertices max 3;\nprivate _radius = 100;\n\nfor \"_i\" from 1 to _numVertices do\n{\n    vertices pushBack (player getRelPos [_radius, 360 / _numVertices * _i]);\n};\n\nfindDisplay 12 displayCtrl 51 ctrlAddEventHandler [\"Draw\",\n{\n    params [\"_control\"];\n    _control drawPolygon [vertices, [0,0,1,1]];\n}];\n```","code":["vertices = [];\nprivate _numVertices = 2;\nprivate _numVertices = _numVertices max 3;\nprivate _radius = 100;\n\nfor \"_i\" from 1 to _numVertices do\n{\n\tvertices pushBack (player getRelPos [_radius, 360 / _numVertices * _i]);\n};\n\nfindDisplay 12 displayCtrl 51 ctrlAddEventHandler [\"Draw\",\n{\n\tparams [\"_control\"];\n\t_control drawPolygon [vertices, [0,0,1,1]];\n}];"]}],"see_also":["drawEllipse","drawIcon","drawLine","drawRectangle","drawArrow","drawTriangle","inPolygon","drawXPolygon"]}