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
3 answers

Make two transparent images overlap using CSS

I'm trying to make two transparent images (having the same size/dimension) overlap within a div at their top left corners. I tried:
Pierre
  • 34,472
  • 31
  • 113
  • 192
4
votes
1 answer

OverlapCircleAll is not picking up other objects

I am trying to get all objects within a distance of the current object. the maxShootDistance is set to 3, and when an object that is part of the ShootAt layer gets near/in the circle, it is never picked up, and my debug outputs 0. Why isn't it…
Get Off My Lawn
  • 34,175
  • 38
  • 176
  • 338
4
votes
3 answers

SQL - Consolidate Overlapping Data

I have a simple data set in SQL Server that appears like this **ROW Start End** 0 1 2 1 3 5 2 4 6 3 8 9 Graphically, the data would appear like this What I would like to achieve is to…
jamesamuir
  • 1,397
  • 3
  • 19
  • 41
4
votes
1 answer

D3.js Independent Charts and Divs Overlapping

I have two histograms with .on("mouseover") listeners. Each is bound to a unique div id. For some reason they plot on the same SVG element. I've tried to follow the pattern from "D3 Tips and Tricks" ...