Intereting Posts

Convergence at infinitely many points in a compact set and convergence in the whole region
Simple linear map question
implicit equation for “double torus” (genus 2 orientable surface)
Taking a derivative with respect to a matrix
Complex Measures: Lebesgue
Proof that 1-1 analytic functions have nonzero derivative
Double factorial series
Eigenvalues of an operator
(Possible) application of Sarason interpolation theorem
Yoneda-Lemma as generalization of Cayley`s theorem?
Automation of 3D Paper Modeling
the real part of a holomorphic function on C \ {0, 1}
Minimizing the cost of a path in a dynamic system
How to show the Symmetric Group $S_4$ has no elements of order $6$.
Infinite intersection between a arbitrary set of integers and a set of floor powers

I have a problem where I have TWO NON-rotated rectangles (given as two point tuples {x1 x2 y1 y2}) and I like to calculate their intersect area. I have seen more general answers to this question, e.g. more rectangles or even rotated ones, and I was wondering whether there is a much simpler solution as I only have two non-rotated rectangles.

What I imagine should be achievable is an algorithm that only uses addition, subtraction and multiplication, possibly abs() as well. What certainly should not be used are min/max, equal, greater/smaller and so on, which would make the question obsolete.

Thank you!

- The cow in the field problem (intersecting circular areas)
- What is the dot product and why do we need it?
- Find the maximum area possible of equilateral triangle that inside the given square
- In this isosceles right angled triangle, prove that $\angle DAE = 45^{\circ}$
- Finding vertices of regular polygon
- Finding the point on an ellipse most distant from a given line

EDIT 2: okay, it’s become too easy using min/max or abs(). Can somebody show or disprove the case only using add/sub/mul?

EDIT: let’s relax it a little bit, only conditional expressions (e.g. if, case) are prohibited!

PS: I have been thinking about it for a half hour, without success, maybe I am now too old for this ðŸ™‚

- How to prove there are exactly eight convex deltahedra?
- Picture of a 4D knot
- How to place objects equidistantly on an Archimedean spiral?
- Splitting equilateral triangle into 5 equal parts
- On a “1-D line”, the point that minimizes the sum of the distances is the median, WHY?
- General Formula for Equidistant Locus of Three Points
- Expected area of the intersection of of triangles made up random points inside a circle, all the triangles must contain the origin
- Average Degree of a Random Geometric Graph
- Decompose rotation matrix to plane of rotation and angle
- Derivation of the formula for the area of a regular polygon given the side length.

Uses only max and min (drag the squares to see the calculation. Forget about most of the code, the calculation is those two lines with the min and max):

You can also reduce min to max here (or the opposite), i.e. $min\{a,b\} = -max\{-a,-b\}$.

First compute the bounding rectangles `rect1`

and `rect2`

with the following properties:

```
rect = {
left: x1,
right: x1 + x2,
top: y1,
bottom: y1 + y2,
}
```

The overlap area can be computed as follows:

```
x_overlap = Math.max(0, Math.min(rect1.right, rect2.right) - Math.max(rect1.left, rect2.left));
y_overlap = Math.max(0, Math.min(rect1.bottom, rect2.bottom) - Math.max(rect1.top, rect2.top));
overlapArea = x_overlap * y_overlap;
```

- Are polynomials dense in Gaussian Sobolev space?
- Condition for commuting matrices
- Rain droplets falling on a table
- Do limits evaluated at infinity exist?
- A smooth function's domain of being non-analytic
- Is a Sobolev function absolutely continuous with respect to a.e.segment of line?
- Learning Model Theory
- Do “other” trigonometric functions than Tan Sin Cos and their derivatives exist?
- Looking for a book: $B(H)$ not reflexive
- An orthonormal set cannot be a basis in an infinite dimension vector space?
- Picturing the how the covariant derivative acts on vector fields
- Quadratic Integers in $\mathbb Q$
- Module homomorphism surjective but not injective
- Examples of finite nonabelian groups.
- Why do we believe the equation $ax+by+c=0$ represents a line?