Skip to content

Commit b5449de

Browse files
committed
Updated punch description.
1 parent 99e3b01 commit b5449de

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

README.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ Options are:
182182
- [After deoverlap](#after-deoverlap)
183183
- [interval\_tree deoverlap\_copy()](#interval_tree-deoverlap_copy)
184184
- [interval\_tree punch(interval\_type const\& ival)](#interval_tree-punchinterval_type-const-ival)
185-
- [After punching (with \[0, 50\])](#after-punching-with-0-50)
185+
- [Before punching (closed intervals)](#before-punching-closed-intervals)
186+
- [After punching (with \[-10, 60\])](#after-punching-with--10-60)
186187
- [interval\_tree punch()](#interval_tree-punch)
187188
- [bool empty() const noexcept](#bool-empty-const-noexcept)
188189
- [iterator begin()](#iterator-begin)
@@ -367,13 +368,19 @@ Same as deoverlap, but not inplace
367368

368369
---
369370
### interval_tree punch(interval_type const& ival)
370-
Removes all intervals from `ival` and produces a tree that contains the remaining intervals.
371-
**The tree must be deoverlapped, or the result is undefined.**
372-
`ival` is expected to encompass the entire interval range.
371+
Cuts the intervals of the tree out of the given interval. Like a cookie cutter cuts out of dough.
372+
This will return a new interval_tree containing the gaps between the intervals in the tree and the given interval.
373+
Closed (and closed adjacent) intervals are treated as exclusive on the borders. [0,5][6,10] will not produce another interval between 5 and 6 as they are considered within the intervals and nothing fits inbetween.
374+
Open intervals will not behave like this, so (0,5)(6,10) will produce a new interval (5,6).
375+
376+
**IMPORTANT! The tree must be deoverlapped, or the result is undefined.**
377+
`ival` can be any subrange of the tree, including encompassing the whole tree.
373378

374379
**Returns**: A new interval_tree containing the gaps.
375-
### After punching (with [0, 50])
376-
![AfterPunch](https://cloud.githubusercontent.com/assets/6238896/24613645/2dbf72e8-1889-11e7-813f-6d16fe0ad327.png)
380+
### Before punching (closed intervals)
381+
![BeforePunch](https://private-user-images.githubusercontent.com/6238896/471147224-5c631e00-dea4-4b75-a3bf-6fdd8ec1440b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTM1NjI1MzQsIm5iZiI6MTc1MzU2MjIzNCwicGF0aCI6Ii82MjM4ODk2LzQ3MTE0NzIyNC01YzYzMWUwMC1kZWE0LTRiNzUtYTNiZi02ZmRkOGVjMTQ0MGIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDcyNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTA3MjZUMjAzNzE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDQ0NWIwMTcwMjZhNDA1YmUwNGI1YTIzNTBhZTQ5OTNhMWFiOTU5ZmU0N2E3NDI0NTQ0MzYwODA4N2E2MGFiZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.P5zLeXg0-9bd20Thj6pfq_WxriMn4GC_lDSLzzGKMbw)
382+
### After punching (with [-10, 60])
383+
![AfterPunch](https://private-user-images.githubusercontent.com/6238896/471147227-5c226d1d-d544-4a43-89a4-b3545145107d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTM1NjI1MzQsIm5iZiI6MTc1MzU2MjIzNCwicGF0aCI6Ii82MjM4ODk2LzQ3MTE0NzIyNy01YzIyNmQxZC1kNTQ0LTRhNDMtODlhNC1iMzU0NTE0NTEwN2QucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDcyNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTA3MjZUMjAzNzE0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NmE2ZDUzMjU2ZTNjZWQ0Y2QzYjQ3ZGUyYjgyNWM2NDViYTAxMTdlY2RjYmQyMzg4OWFmZDlhMWU5YjY4NjlmZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.Infe9i281LDOEC5GeBFuLHVE6Xjqw7KvcUo-gv3hjpk)
377384

378385
---
379386
### interval_tree punch()

0 commit comments

Comments
 (0)