RegionWithin
✖
RegionWithin
Details and Options

- The region reg2 is contained within reg1 if every point that belongs to reg2 also belongs to reg1.
- If all regi are parameter-free regions, i.e. ConstantRegionQ[regi] is True, the regions are point sets, and typically True or False is returned.
- If some regi depend on parameters, i.e. ConstantRegionQ[regi] is False, then regi represents a family of regions, and RegionWithin will attempt to compute conditions on parameters such that reg2 is contained within reg1.
- The following options can be given:
-
Assumptions $Assumptions assumptions to make about parameters GenerateConditions False whether to generate conditions on parameters

Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Test whether a region is contained within another:

https://wolfram.com/xid/0i1ptbttm-bwhjpw

https://wolfram.com/xid/0i1ptbttm-2rib4


https://wolfram.com/xid/0i1ptbttm-ch8cm5

Generate conditions for which a region is contained within another:

https://wolfram.com/xid/0i1ptbttm-bjcd6

https://wolfram.com/xid/0i1ptbttm-bgxf3h

Scope (15)Survey of the scope of standard use cases
Basic Uses (3)

https://wolfram.com/xid/0i1ptbttm-eb93s9

https://wolfram.com/xid/0i1ptbttm-firoum


https://wolfram.com/xid/0i1ptbttm-gfcy2o

Show a region is not within another:

https://wolfram.com/xid/0i1ptbttm-82vpaa

https://wolfram.com/xid/0i1ptbttm-z64t9f


https://wolfram.com/xid/0i1ptbttm-30lfif

Find conditions that make a region a subset of another:

https://wolfram.com/xid/0i1ptbttm-tnzyl9

https://wolfram.com/xid/0i1ptbttm-w8dsx6

Basic Regions (4)
Regions in including Line and Interval:

https://wolfram.com/xid/0i1ptbttm-6v3c9q


https://wolfram.com/xid/0i1ptbttm-uiw53u

Ball:

https://wolfram.com/xid/0i1ptbttm-0a693w


https://wolfram.com/xid/0i1ptbttm-586b1i

Regions in including Point:

https://wolfram.com/xid/0i1ptbttm-i2fp1e

https://wolfram.com/xid/0i1ptbttm-fcyt2v

Line:

https://wolfram.com/xid/0i1ptbttm-gnymc0

https://wolfram.com/xid/0i1ptbttm-fw05sb


https://wolfram.com/xid/0i1ptbttm-cpipc8


https://wolfram.com/xid/0i1ptbttm-45f5fx

https://wolfram.com/xid/0i1ptbttm-if4go9


https://wolfram.com/xid/0i1ptbttm-co6226


https://wolfram.com/xid/0i1ptbttm-0aeidt

https://wolfram.com/xid/0i1ptbttm-te9loc

Rectangle and RegularPolygon:

https://wolfram.com/xid/0i1ptbttm-3el84j

Regions in including Point:

https://wolfram.com/xid/0i1ptbttm-ivezrn

https://wolfram.com/xid/0i1ptbttm-v4vks4

Line:

https://wolfram.com/xid/0i1ptbttm-lm5ega

https://wolfram.com/xid/0i1ptbttm-w3c7x0


https://wolfram.com/xid/0i1ptbttm-t559ku

https://wolfram.com/xid/0i1ptbttm-uaqco4


https://wolfram.com/xid/0i1ptbttm-pmg8fc

Cuboid and Hexahedron:

https://wolfram.com/xid/0i1ptbttm-35c0r8

https://wolfram.com/xid/0i1ptbttm-g2ry70


https://wolfram.com/xid/0i1ptbttm-g1mnn1

https://wolfram.com/xid/0i1ptbttm-3j14kp

Tetrahedron and Simplex:

https://wolfram.com/xid/0i1ptbttm-ilyuwb

https://wolfram.com/xid/0i1ptbttm-o1w6u8

Regions in including Cuboid and Parallelepiped in
:

https://wolfram.com/xid/0i1ptbttm-02h4ee

https://wolfram.com/xid/0i1ptbttm-29ru1s


https://wolfram.com/xid/0i1ptbttm-ufst9o

https://wolfram.com/xid/0i1ptbttm-8t7at1

Formula Regions (4)

https://wolfram.com/xid/0i1ptbttm-yhhbit

https://wolfram.com/xid/0i1ptbttm-uj1qf1


https://wolfram.com/xid/0i1ptbttm-hukmm5

https://wolfram.com/xid/0i1ptbttm-jgs1z1


https://wolfram.com/xid/0i1ptbttm-eie8c4

https://wolfram.com/xid/0i1ptbttm-w59lx6


https://wolfram.com/xid/0i1ptbttm-hic6g2

Mesh Regions (3)
Compare MeshRegion in :

https://wolfram.com/xid/0i1ptbttm-5yev98

https://wolfram.com/xid/0i1ptbttm-ciss1i


https://wolfram.com/xid/0i1ptbttm-6p9mf1

https://wolfram.com/xid/0i1ptbttm-9eeqmu


https://wolfram.com/xid/0i1ptbttm-pmpsgg


https://wolfram.com/xid/0i1ptbttm-ron1r2

https://wolfram.com/xid/0i1ptbttm-83vd07


https://wolfram.com/xid/0i1ptbttm-lz7nun

Compare BoundaryMeshRegion in :

https://wolfram.com/xid/0i1ptbttm-ki5zz3

https://wolfram.com/xid/0i1ptbttm-bt2ml0


https://wolfram.com/xid/0i1ptbttm-20k1t

https://wolfram.com/xid/0i1ptbttm-x4jjvo


https://wolfram.com/xid/0i1ptbttm-d3cir4


https://wolfram.com/xid/0i1ptbttm-lwhzff

https://wolfram.com/xid/0i1ptbttm-tmarje


https://wolfram.com/xid/0i1ptbttm-2bstik

Compare MeshRegion with BoundaryMeshRegion in :

https://wolfram.com/xid/0i1ptbttm-eq7jc5

https://wolfram.com/xid/0i1ptbttm-n3t5rq


https://wolfram.com/xid/0i1ptbttm-w76nww


https://wolfram.com/xid/0i1ptbttm-t4fi8f

https://wolfram.com/xid/0i1ptbttm-xmhkjc


https://wolfram.com/xid/0i1ptbttm-vj7fl4

Derived Regions (1)
Compare BooleanRegion:

https://wolfram.com/xid/0i1ptbttm-pk317t

https://wolfram.com/xid/0i1ptbttm-15qu2j

Options (2)Common values & functionality for each option
Assumptions (1)
GenerateConditions (1)
Find when the unit disk lies within an implicitly described annulus:

https://wolfram.com/xid/0i1ptbttm-y7rzg1

https://wolfram.com/xid/0i1ptbttm-2foycc

Show the conditions for which the result is valid:

https://wolfram.com/xid/0i1ptbttm-ysjw49

Explicitly allow for degenerate cases:

https://wolfram.com/xid/0i1ptbttm-cxiwq

Applications (7)Sample problems that can be solved with this function
All convex combinations of points lie within their convex hull:

https://wolfram.com/xid/0i1ptbttm-c2siwi

https://wolfram.com/xid/0i1ptbttm-rvuhoh

https://wolfram.com/xid/0i1ptbttm-sg67y4


https://wolfram.com/xid/0i1ptbttm-20lr8e

Find the largest disk contained in a given triangle:

https://wolfram.com/xid/0i1ptbttm-5reuia

https://wolfram.com/xid/0i1ptbttm-kemxj1

https://wolfram.com/xid/0i1ptbttm-r768z0


https://wolfram.com/xid/0i1ptbttm-y86c6e


https://wolfram.com/xid/0i1ptbttm-e2lily

Approximate the largest axes-aligned ellipse contained in the triangle:

https://wolfram.com/xid/0i1ptbttm-lk1i9r

https://wolfram.com/xid/0i1ptbttm-7nzm0f


https://wolfram.com/xid/0i1ptbttm-nz4gh7

Find the smallest disk that contains a given triangle:

https://wolfram.com/xid/0i1ptbttm-9q21li

https://wolfram.com/xid/0i1ptbttm-55wznh

https://wolfram.com/xid/0i1ptbttm-7s5d4s


https://wolfram.com/xid/0i1ptbttm-vpxmz7

Find the smallest axes-aligned ellipse that contains the triangle:

https://wolfram.com/xid/0i1ptbttm-mxybiw

https://wolfram.com/xid/0i1ptbttm-dtlowt


https://wolfram.com/xid/0i1ptbttm-ibd3df


https://wolfram.com/xid/0i1ptbttm-73ihbu

Find all countries that lie completely within the Caribbean Sea:

https://wolfram.com/xid/0i1ptbttm-fpdlyt

https://wolfram.com/xid/0i1ptbttm-4p25ou
Select the countries whose polygons lie within the Caribbean Sea:

https://wolfram.com/xid/0i1ptbttm-s9dghf


https://wolfram.com/xid/0i1ptbttm-g10uxt

View these countries on a map:

https://wolfram.com/xid/0i1ptbttm-h95zbe

Find and visualize all positions where a unit rectangle lies within an annulus:

https://wolfram.com/xid/0i1ptbttm-59poq7

https://wolfram.com/xid/0i1ptbttm-4rztjs

https://wolfram.com/xid/0i1ptbttm-xjaxyl

Perform a random walk inside a region:

https://wolfram.com/xid/0i1ptbttm-1eu4a3
Define a function to walk a point in a random direction, staying inside a region:

https://wolfram.com/xid/0i1ptbttm-2t78a9
Simulate a random walk from an initial point:

https://wolfram.com/xid/0i1ptbttm-v10re3

https://wolfram.com/xid/0i1ptbttm-pootx3

https://wolfram.com/xid/0i1ptbttm-2vflrc

Use RegionWithin as a partial ordering to visualize concentric disks:

https://wolfram.com/xid/0i1ptbttm-y0dxc3

https://wolfram.com/xid/0i1ptbttm-w28qj9
Disks with larger radii can completely cover other disks:

https://wolfram.com/xid/0i1ptbttm-zxfkg6

Sort the regions according to membership:

https://wolfram.com/xid/0i1ptbttm-di1dof
Visualize the rearranged disks:

https://wolfram.com/xid/0i1ptbttm-0t46az

Properties & Relations (5)Properties of the function, and connections to other functions
Use RegionMember to test the membership of a point:

https://wolfram.com/xid/0i1ptbttm-vw067z

https://wolfram.com/xid/0i1ptbttm-zxr7hs

Use RegionWithin to test the membership of a region:

https://wolfram.com/xid/0i1ptbttm-yq8nk9


https://wolfram.com/xid/0i1ptbttm-kj9dnc

When ℛ2 is within ℛ1, all points in ℛ2 are members of ℛ1:

https://wolfram.com/xid/0i1ptbttm-ga16k4

https://wolfram.com/xid/0i1ptbttm-o48yw3


https://wolfram.com/xid/0i1ptbttm-szw6pm

Check if two regions are equal:

https://wolfram.com/xid/0i1ptbttm-fe5guh

https://wolfram.com/xid/0i1ptbttm-ej7p5t


https://wolfram.com/xid/0i1ptbttm-px5lwy

For non‐empty regions, RegionDisjoint returns False when RegionWithin returns True:

https://wolfram.com/xid/0i1ptbttm-bq0ked

https://wolfram.com/xid/0i1ptbttm-foaup4


https://wolfram.com/xid/0i1ptbttm-k8st6l

Use FindInstance to find points that violate the subset condition:

https://wolfram.com/xid/0i1ptbttm-ecv99p

https://wolfram.com/xid/0i1ptbttm-i0zv76


https://wolfram.com/xid/0i1ptbttm-vjwpmf

https://wolfram.com/xid/0i1ptbttm-mccqg1

Use RandomPoint to find a uniform sampling of points that violate the subset condition:

https://wolfram.com/xid/0i1ptbttm-gpkt0l

https://wolfram.com/xid/0i1ptbttm-o0kf7b

Use Reduce to find where the subset condition is violated:

https://wolfram.com/xid/0i1ptbttm-42jril


https://wolfram.com/xid/0i1ptbttm-ly4r2m

Wolfram Research (2017), RegionWithin, Wolfram Language function, https://reference.wolfram.com/language/ref/RegionWithin.html.
Text
Wolfram Research (2017), RegionWithin, Wolfram Language function, https://reference.wolfram.com/language/ref/RegionWithin.html.
Wolfram Research (2017), RegionWithin, Wolfram Language function, https://reference.wolfram.com/language/ref/RegionWithin.html.
CMS
Wolfram Language. 2017. "RegionWithin." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RegionWithin.html.
Wolfram Language. 2017. "RegionWithin." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RegionWithin.html.
APA
Wolfram Language. (2017). RegionWithin. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RegionWithin.html
Wolfram Language. (2017). RegionWithin. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RegionWithin.html
BibTeX
@misc{reference.wolfram_2025_regionwithin, author="Wolfram Research", title="{RegionWithin}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/RegionWithin.html}", note=[Accessed: 26-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_regionwithin, organization={Wolfram Research}, title={RegionWithin}, year={2017}, url={https://reference.wolfram.com/language/ref/RegionWithin.html}, note=[Accessed: 26-March-2025
]}