polygon_util¶
Source: base/tealdef/scripts/polygon_util.d.tl
Notes
Types of /scripts/polygon_util.tl (PolygonUtil) for 2D polygons given as lists of Vec2f points.
PolygonUtil¶
record global base/tealdef/scripts/polygon_util.d.tl:3
global record PolygonUtil
Load: local polygon_util = ug_require "::/scripts/polygon_util.tl"
Notes
Polygon helpers returned by ug_require "/scripts/polygon_util.tl".
Functions
transform(mat : Mat4f, polygon : Polygon) : Polygon base/tealdef/scripts/polygon_util.d.tl:6
Call as polygon_util.transform
Notes
Applies the X/Y part of a 4x4 transform (rotation, scale and translation in the ground plane) to each point.
Returns Polygon: A new polygon.
Used in the base game: 5 times in 2 files
mods/release/urbangames_campaign_mission_02/content/mission/mission/mission_story.tl:731
polygon = polygon_util.transform(api.type.Mat4f.rotZTransl(params.streetDepotAngle, api.type.Vec3f.new(params.streetDepotZone.pos[1], params.streetDepotZone.pos
mods/release/urbangames_campaign_mission_01/content/mission/mission/mission_story.tl:766
makeQuad(bottomLeft : Vec2f, topRight : Vec2f) : Polygon base/tealdef/scripts/polygon_util.d.tl:7
Call as polygon_util.makeQuad
Notes
Axis-aligned rectangle from its bottom-left and top-right corners, in counter-clockwise order starting at bottom-left.
Returns Polygon
contains(polygon : Polygon, pos : Vec2f) : boolean base/tealdef/scripts/polygon_util.d.tl:8
Call as polygon_util.contains
Notes
True if pos is inside the polygon (even-odd rule) or exactly on one of its corner points.
Returns boolean
Used in the base game: 2 times in 2 files
base/content/mission/mission/tasks/build_construction/build_construction_variant.tl:82
base/content/mission/mission/tasks/build_construction/mission_task_build_construction_util.tl:323
offset(polygon : Polygon, offset : number) : Polygon base/tealdef/scripts/polygon_util.d.tl:9
Call as polygon_util.offset
Notes
Moves every edge of the polygon outwards or inwards by offset and returns the new corner points.
Returns Polygon
Details
The direction depends on the winding order of the polygon; try the sign on your polygon.
PolygonUtil.Polygon¶
record base/tealdef/scripts/polygon_util.d.tl:4
record Polygon is {Vec2f}
Notes
A 2D polygon as a list of Vec2f corner points.
Used in the base game: 31 times in 7 files
base/content/mission/mission/mission_outline.tl:31
base/content/mission/mission/tutorial/tutorial_story_branch_b.tl:117
base/content/mission/mission/tutorial/tutorial_story_branch_a.tl:118
base/content/mission/mission/tutorial/tutorial_story_util.tl:254
base/content/mission/mission/tasks/build_construction/build_construction_variant.tl:10
local boundingCircleFromPolygon = function(polygon : PolygonUtil.Polygon) : MissionInterface.PosRadius
base/content/mission/mission/tasks/build_construction/mission_task_build_construction_util.tl:320
… and 1 more files.