LCOV - code coverage report
Current view: top level - maps/random/rmgen/placer/noncentered - RectPlacer.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 8 8 100.0 %
Date: 2023-04-02 12:52:40 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /**
       2             :  * The RectPlacer returns all tiles between the two given points that meet the Constraint.
       3             :  */
       4             : function RectPlacer(start, end, failFraction = Infinity)
       5             : {
       6           3 :         this.bounds = getBoundingBox([start, end]);
       7           3 :         this.bounds.min.floor();
       8           3 :         this.bounds.max.floor();
       9           3 :         this.failFraction = failFraction;
      10             : }
      11             : 
      12           6 : RectPlacer.prototype.place = function(constraint)
      13             : {
      14           3 :         let bboxPoints = getPointsInBoundingBox(this.bounds);
      15          67 :         let points = bboxPoints.filter(point => g_Map.inMapBounds(point) && constraint.allows(point));
      16           3 :         return (bboxPoints.length - points.length) / bboxPoints.length <= this.failFraction ? points : undefined;
      17             : };

Generated by: LCOV version 1.14