Given two regions $D_1, D_2 \subseteq \mathbb{R}^2$, I'm looking to combine them by adding pointwise: $$D_1 + D_2 := \left\{ (a+x, b+y) \mid (a,b) \in D_1, (x,y) \in D_2 \right\}.$$ Even more generally, given a map $f:\mathbb{R}^l \times \mathbb{R}^m \to \mathbb{R}^n$, combine the regions $D_1\subseteq \mathbb{R}^l, D_2 \subseteq \mathbb{R}^m$ using $f$ over all pointwise combinations: $$f(D_1 , D_2) := \left\{ f (\vec{a}, \vec{x} ) \mid \vec{a} \in D_1, \vec{x} \in D_2 \right\}.$$

Is there an elegant way to do this in Mathematica? Something like f[r1,r2] or Outer[f, r1,r2,1]? Here's a MWE and the closest I've been able to come (which works, but feels clunky). My approach is to explicitly construct the Cartesian product using RegionProduct and then apply a mapping f using TransformedRegion

r1=Rectangle[]; r2=Disk[]; f[{a_,b_,x_,y_}]:={a+x,b+y} Region@TransformedRegion[RegionProduct[r1, r2], f]

Combined Regions

Surely there's a built-in function or piece of syntax I'm missing?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.