Questions tagged [overlap]

Two or more elements overlap when they partially or totally cover one another.

Two or more elements overlap when they partially or totally cover one another.
The way to find if the elements overlap or not is to test if one elements begins before the second one ends, while the second one begins before the first one ends.

For example, here are all of the ways two lines can overlap:

1.
s1|--------|e1
s2|--------|e2


2.
s1|-------|e1
     s2|--------|e2


3.
     s1|--------|e1
s2|--------|e2


4.
s1|-------------------|e1
     s2|--------|e2


5.
     s1|--------|e1
s2|-------------------|e2

Note that s1 is always smaller than e2, while s2 is always smaller than e1.

This is not the case when the two lines do not overlap:

1.
s1|--------|e1
                 s2|--------|e2


2.
                 s1|--------|e1
s2|--------|e2

Note that either s1 is bigger then e2 or s2 is bigger then e1.

The actual data type of the elements is completely irrelevant as long as it's comparable.

Therefore, to check if two elements overlap each other, all you need to do is this: (pseudo code)

If a.Start < b.End AND b.Start < a.End Then
    Overlap
Else
    No overlap
1905 questions
4
votes
1 answer

How to fix overlapping vertical scrollbar in gridview with fixed width columns

I have a gridview with fixed width columns, and I want to enable vertical scrolling. The problem I am having is that when the scrollbar appears it overlaps the rightmost column (which is a currency value, causing the decimal part of the value to…
Malcolm O'Hare
  • 4,879
  • 3
  • 33
  • 53
4
votes
3 answers

How to count overlap rows among multiple dataframes?

I have a multiple dataframe like below. df1 = pd.DataFrame({'Col1':["aaa","ddd","ggg"],'Col2':["bbb","eee","hhh"],'Col3':"ccc","fff","iii"]}) df2= pd.DataFrame({'Col1':["aaa","zzz","qqq"],'Col2':["bbb","xxx","eee"],'Col3':["ccc", yyy","www"]}) df3=…
Tom_Hanks
  • 517
  • 1
  • 6
  • 15
4
votes
4 answers

Find new position for overlapping circles

I am trying to write a code that, for a given list of circles (list1), it is able to find the positions for new circles (list2). list1 and list2 have the same length, because for each circle in list1 there must be a circle from list2. Each pair of…
Alessandro Peca
  • 873
  • 1
  • 15
  • 40
4
votes
3 answers

Combine overlapping ranges of numbers

I need to combine overlapping ranges of numbers into single range. So I have a list with sub-lists of something…
XelaGreb
  • 71
  • 6
4
votes
2 answers

Number of overlaping datetime inside same table (R)

I have a table of about 50 000 rows, with four columns. ID Arrival Departure Gender 1 10/04/2015 23:14 11/04/2015 00:21 F 1 11/04/2015 07:59 11/04/2015 08:08 F 3 10/04/2017 21:53 …
4
votes
3 answers

Is there any way to have UI elements slightly overlap (one on top of one another) without using absolute layouts?

Lets say I have a list on screen, which I always want to be usable. I also want a small image or textview to slightly overlap the listview. Is anything this possible without using absolute layout parameters? I've never seen it in any android app or…
NotACleverMan
  • 12,107
  • 12
  • 47
  • 67
4
votes
2 answers

Passing mouse events to overlapped controls

My WPF user control consists of a few subcomponents, placed in such way that they overlap each other (sometimes completely), however they are on the same level on the visual tree (each subcomponent's parent is the main grid). I wish to pass mouse…
Spook
  • 25,318
  • 18
  • 90
  • 167
4
votes
1 answer

How to Create an overlap chain in ConstraintLayout Android Studio

I want to create an overlap chain which keep needed margin than other elements and they may have more elements next to each other. Like this:
4
votes
2 answers

Determine max number of overlapping DATETIME ranges

I got a table with some DATETIME ranges, something like id | start | end ---------------------------------------------- 1 | 2011-12-18 16:00:00 | 2011-12-18 17:00:00 2 | 2011-12-19 08:00:00 | 2011-12-19 10:00:00 3 | 2011-12-19…
fudo
  • 2,254
  • 4
  • 22
  • 44
4
votes
6 answers

how to overlap intervals efficiently

I require your help, I have a problem (see picture), I have let say two arrays and each of this array contains intervals with different length and real values and I need to find out how I'm gone overlap this intervals efficiently. I'm open to ideas,…
4
votes
3 answers

Merge two sorted lists of intervals

Given A and B, which are two interval lists. A has no overlap inside A and B has no overlap inside B. In A, the intervals are sorted by their starting points. In B, the intervals are sorted by their starting points. How do you merge the two interval…
user9577088
  • 75
  • 1
  • 6
4
votes
4 answers

A better way to split a sequence in chunks with overlaps?

I need a function to split an iterable into chunks with the option of having an overlap between the chunks. I wrote the following code, which gives me the correct output but that is quite inefficient (slow). I can't figure out how to speed it up. Is…
alec_djinn
  • 10,104
  • 8
  • 46
  • 71
4
votes
1 answer

Find total duration of many overlapping times

I have a list of dates and times for employee time sheets. The times begin in column F, and end in column G. Sometimes there are overlapping times for projects. The employee does not get paid for overlapping projects, yet we need to track each…
Neill
  • 452
  • 2
  • 6
  • 19
4
votes
5 answers

Quickest way to determine range overlap in Perl

I have two sets of ranges. Each range is a pair of integers (start and end) representing some sub-range of a single larger range. The two sets of ranges are in a structure similar to this (of course the ...s would be replaced with actual…
Daniel Standage
  • 8,136
  • 19
  • 69
  • 116
4
votes
1 answer

Number of overlaping windows for an audio signal

I have an audio signal, of length n and I want to divide it into windows of length k, with an overlap r < k. What is the number of windows I will obtain, from my audio signal? I calculated it to be n/(k-r) - r but I now see that it is wrong.
Qubix
  • 4,161
  • 7
  • 36
  • 73