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
1695 questions
18
votes
6 answers

UISearchBar overlaps status bar in iOS

I (just like everyone else here) am running into the same Status Bar overlap issue that everyone else is, with a little twist, and that is why I opening a new question about this. There seems to be some mechanism that lets the UISearchBar know…
Fotis Paraskevopoulos
  • 961
  • 2
  • 10
  • 19
17
votes
2 answers

Find overlapping date ranges in PostgreSQL

Is this correct? SELECT * FROM contract JOIN team USING (name_team) JOIN player USING(name_player) WHERE name_team = ? AND DATE_PART('YEAR',date_join)>= ? AND DATE_PART('YEAR',date_leave)<= ? My table contract has the player…
aocferreira
  • 633
  • 2
  • 8
  • 15
17
votes
4 answers

Percentage Overlap of Two Lists

This is more of a math problem than anything else. Lets assume I have two lists of different sizes in Python listA = ["Alice", "Bob", "Joe"] listB = ["Joe", "Bob", "Alice", "Ken"] I want to find out what percentage overlap these two lists have.…
OneManRiot
  • 733
  • 2
  • 6
  • 20
17
votes
3 answers

Maven-shade-plugin, uber-jar and overlapping classes

I would like to use Maven-shade-plugin to create uber-jar. But when I call mvn package command Maven reports that there are some overlapping classes. I am attaching all problematic overlapps, some of them are caused because older and new verion of a…
user2148736
  • 1,173
  • 3
  • 19
  • 39
16
votes
2 answers

Understanding Overlap and Add for Filtering

I am trying to implement the overlap and add method in oder to apply a filter in a real time context. However, it seems that there is something I am doing wrong, as the resulting output has a larger error than I would expect. For comparing the…
st-h
  • 2,162
  • 3
  • 31
  • 51
16
votes
2 answers

Z-index doesn't work with flex elements?

I'm trying to have two columns, one being a menu which can expand and overlap the other column. But I used a flex element to wrap these columns and my menu expands behind the other element, even with a greater z-index. The render is something like…
F. Morival
  • 241
  • 1
  • 2
  • 8
15
votes
2 answers

Overlapping/overlaying multiple inline images

I have a list of images I'm trying to overlap so that they look similar to this: My code: .avatar img { border-radius: 50%; position: relative; left: -5px; z-index: 1; }
Chicken Suop
  • 1,047
  • 3
  • 12
  • 32
14
votes
1 answer

Wykobi - Error: Explicit instantiation shall not use ‘inline’ specifier [-fpermissive]

I am trying to make / compile wykobi library (computational geometry) using the given makefile, but I keep getting the error: error: explicit instantiation shall not use ‘inline’ specifier [-fpermissive] How can I solve this?
Harsha Rama
  • 339
  • 1
  • 4
  • 11
14
votes
2 answers

Border is cutting off when using border-radius?

I have an image which has a 5px border around it and I wanted to round the corners of both the image and the border, but in webkit the image remained rectangular whereas the corners of the border were rounded. As a result, the image overlapped the…
RMi Flores
  • 291
  • 3
  • 6
  • 14
13
votes
7 answers

When screen size made smaller bootstrap tabs are overlapping

When screen size made smaller bootstrap tabs are overlapping like image. I used col-sm and my angular HTML is like this (but any non-angular HTML solution is fine too):
Kle
  • 821
  • 1
  • 12
  • 21
12
votes
3 answers

Avoid overlapping axis labels in R

I want to plot data in a graph with larger font-size for the lables. x = c(0:10) y = sin(x) + 10 plot ( x, y, type="o", xlab = "X values", ylab = "Y values", cex.axis = "2", cex.lab = "2", las = 1 ) Unfortunately the…
R_User
  • 9,332
  • 22
  • 68
  • 115
12
votes
4 answers

Fastest way to split overlapping date ranges

I have date range data in SQL DB table that has these three (only relevant) columns: ID (int identity) RangeFrom (date only) RangeTo (date only) For any given date range, there may be an arbitrary number of records that may overlap (completely or…
Robert Koritnik
  • 97,460
  • 50
  • 267
  • 388
12
votes
5 answers

First view above / overlapping second in LinearLayout

Is it possible to show the first view in a LinearLayout overlapping the second? I would like to layout my views like so:
RileyE
  • 10,308
  • 12
  • 60
  • 103
12
votes
2 answers

Finding the overlapping area of two rectangles (in C#)

Edit: Simple code I used to solve the problem in case anyone is interested (thanks to Fredrik): int windowOverlap(Rectangle rect1, Rectangle rect2) { if (rect1.IntersectsWith(rect2)) { Rectangle overlap =…
Evan
  • 4,250
  • 10
  • 37
  • 58
11
votes
5 answers

How to prevent floating content in two divs from overlapping?

In a FAQ page I'm trying to make I have a page with this structure: