2022-11-13 00:15:17 +00:00
/// <reference path="../../../udbscript.d.ts" />
2022-01-06 17:46:37 +00:00
` #version 4 ` ;
2021-11-28 13:00:24 +00:00
` #name Triangulate Sectors ` ;
` #description Triangulates the selected or highlighted sectors into new sectors. Note that the triangulation will not "be beautiful", and that the sectors with islands may cause problems. ` ;
2022-01-06 17:46:37 +00:00
let sectors = UDB . Map . getSelectedOrHighlightedSectors ( ) ;
2021-11-28 13:00:24 +00:00
if ( sectors . length == 0 )
2022-01-06 17:46:37 +00:00
UDB . die ( 'No sectors selected or highlighted' ) ;
2021-11-28 13:00:24 +00:00
// Draw all triangles. Remember to add the first point at the end so that the drawing will be closed
2022-01-06 17:46:37 +00:00
sectors . forEach ( s => s . getTriangles ( ) . forEach ( t => UDB . Map . drawLines ( [ ... t , t [ 0 ] ] ) ) ) ;