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
5
votes
2 answers

Find length of overlap in strings

do you know any ready-to-use method to obtain length and also overlap of two strings? However only with R, maybe something from stringr? I was looking here, unfortunately without succes. str1 <- 'ABCDE' str2 <- 'CDEFG' str_overlap(str1,…
Adamm
  • 2,150
  • 22
  • 30
5
votes
1 answer

How to avoid pie chart labels overlapping in MatPlotLib ver.2.0.2?

There were a lot of questions posted regarding labels overlap for pie chart plotting. However, I couldn't find automated solution except for converting them to the legend. This solution doesn't work for me as I have a lot of values (around 60), and…
K.Ivi
  • 111
  • 2
  • 9
5
votes
2 answers

overlap divs with relative positioning?

Is it possible to overlap divs with CSS without using absolute coordinates -- that is, with relative positioning? I have a background image I split into 3 vertical pieces, 1st one is left-aligned, 2nd one repeats across the middle, 3rd one is…
sova
  • 5,468
  • 10
  • 40
  • 48
5
votes
1 answer

Making widgets partly overlap in a Qt layout

I am trying to make widgets overlap partly in a Qt layout. My current layout is the following, achieved with a QVBoxLayout containing four QHBoxLayout children: I'm trying to regroup cards of the same suit, in order to achieve something like this…
juef
  • 90
  • 1
  • 7
5
votes
1 answer

Overlapped elements with onclick event

Here is the deal: The dark square has a onclick event attached The red square, which overlaps the dark square, also have its own onclick event. When I click the red square, I'd like only the red square's onclick event to be fired. When I click the…
AlexB
  • 7,302
  • 12
  • 56
  • 74
5
votes
6 answers

Making JButtons overlap

I'm creating a virtual piano type program in Java Swing. My area for the piano keys right now is a JPanel with a horizontal BoxLayout containing white JButtons as white keys. I want to add black keys as well, and have them overlap the white…
aharlow
  • 267
  • 1
  • 4
  • 9
5
votes
4 answers

Transparent UIToolBar over UIWebView

I want to have a transparent UIToolBar over a UIWebView, so that the user gets a wider perspective and overview. However, when I do this, you cannot see the bottom of the page. I thought about setting an offset at the bottom, but that can't be…
Emil
  • 7,220
  • 17
  • 76
  • 135
5
votes
0 answers

Gnuplot points overlapping the axis

I've searched about this but I can't find anyone having the same problem (or it may be something really trivial). Case is, when plotting in gnuplot, the points with the same value as the axis overlap this one and is results quite ugly. I've tried…
stonebird
  • 93
  • 2
  • 10
5
votes
1 answer

How to get dates from database and check if they overlaps?

I have a sqlite database in which I store all events. I store StartTime and EndTime against each events in date format. I have fragments for days with tabs and one activity which adds events. Events are shown in another fragments. Now I want to…
Sid
  • 2,792
  • 9
  • 55
  • 111
5
votes
0 answers

Draw heat map on top of a spatial layout image with given coordinates and quantifiable count

Suppose, I have a spacial layout as shown in image 1. I have data about a particular quantity (e.g. Temperature or footfalls) on given x, y coordinate locations. So, basically I have three columns, 1. x coordinate, 2. y coordinate, 3. Footfall/Temp.…
groverpr
  • 59
  • 5
5
votes
1 answer

Duration overlap causing double counting

I'm using SQL Server Management Studio 2008 for query creation. Reporting Services 2008 for report creation. I have been trying to work this out over a couple of weeks and I have hit a brick wall. I’m hoping someone will be able to come up with…
5
votes
1 answer

using renderOrder in three.js

I want to have two overlapping objects in a scene but I want to define which object should be drawn first. I have a sample of the code here: http://jsfiddle.net/sg02e5sm/1/ I'm using renderOrder = 1 for the second object to make it appear always on…
nebeleh
  • 83
  • 1
  • 8
5
votes
2 answers

R overlap multiple GRanges with findOverlaps()

I have three tables with differing genomic intervals. Here is an example: > a chr interval.start interval.end names 1 chr1 5 10 a 2 chr1 6 10 b 3 chr2 7 10 c 4 chr3 …
user2804480
  • 55
  • 2
  • 4
5
votes
1 answer

D3 X-Axis long label overlapping

I have a D3 Bar chart which X-Axis label is overlapping onto each other. I have the following: // word wrapping for x axis svg.append("g") .attr("class", "x axis") .attr("transform", "translate(0," + height + ")") .call(xAxis) attempted…
kenAu89
  • 101
  • 1
  • 11
5
votes
1 answer

Soundcloud: SCLoginViewController overlaps status bar when presented from another view controller

For my iPhone app I want to implement the option to upload files to Soundcloud by making use of the CocoaSoundCloudAPI. In the instructions "How to use the SoundCloud API directly" it is explained how to modally present a loginViewController: -…
Mischa
  • 15,816
  • 8
  • 59
  • 117