if (X1+W1<X2 or X2+W2<X1 or Y1+H1<Y2 or Y2+H2<Y1):
Intersection = Empty
else:
Intersection = Not Empty
If you have four coordinates – ((X,Y),(A,B))
and ((X1,Y1),(A1,B1))
– rather than two plus width and height, it would look like this:
if (A<X1 or A1<X or B<Y1 or B1<Y):
Intersection = Empty
else:
Intersection = Not Empty
Related Contents:
- Calculate distance between two latitude-longitude points? (Haversine formula)
- How to determine if a point is in a 2D triangle? [closed]
- How to create the most compact mapping n → isprime(n) up to a limit N?
- Circle line-segment collision detection algorithm?
- Mapping two integers to one, in a unique and deterministic way
- Algorithm to find Largest prime factor of a number
- Is log(n!) = Θ(n·log(n))?
- Fast permutation -> number -> permutation mapping algorithms
- Algorithm to detect intersection of two rectangles?
- Quicksort: Choosing the pivot
- Least common multiple for 3 or more numbers
- What distribution do you get from this broken random shuffle?
- Sort points in clockwise order?
- Select k random elements from a list whose elements have weights
- Writing your own square root function
- How do you calculate the average of a set of circular data? [closed]
- Algorithm to find which number in a list sum up to a certain number
- Precise subpixel line drawing algorithm (rasterization algorithm)
- Fast way to calculate n! mod m where m is prime?
- What is the fastest integer factorization algorithm?
- Why does this simple shuffle algorithm produce biased results?
- Mapping N-dimensional value to a point on Hilbert curve
- What’s a good algorithm to determine if an input is a perfect square? [duplicate]
- Computing set intersection in linear time?
- Floating Point Divider Hardware Implementation Details
- Fastest algorithm for circle shift N sized array for M position
- Finding out nth fibonacci number for very large ‘n’
- Algorithm for finding similar images
- How to compare two shapes?
- nᵗʰ ugly number
- How can I calculate the age of a person in year, month, days?
- Calculating the position of points in a circle
- Unsupervised clustering with unknown number of clusters
- Test if a number is fibonacci
- Fastest primality test
- How to express tetration function, for complex numbers
- Shortest distance between points algorithm
- Modulus power of big numbers
- 3D Least Squares Plane
- Circle-circle intersection points
- Location of highest density on a sphere
- How do I find a factorial? [closed]
- Determining if two line segments intersect? [duplicate]
- How to calculate the index (lexicographical order) when the combination is given
- How to find the smallest number with just 0 and 1 which is divided by a given number?
- Reverse complex 2D lookup table
- How do I determine whether my calculation of pi is accurate?
- JavaScript: Calculate the nth root of a number
- Given Prime Number N, Compute the Next Prime?
- An inverse Fibonacci algorithm?