RegionMember

RegionMember[reg,{x,y,}]

gives True if the numeric point {x,y,} is a member of the constant region reg and False otherwise.

RegionMember[reg,{x,y,}]

gives conditions for the point {x,y,} to be a member of reg.

RegionMember[reg]

returns a RegionMemberFunction[] that can be applied repeatedly to different points.

Details

  • RegionMember is also known as point in region test, membership test, and membership conditions.
  • A constant region is a region where ConstantRegionQ[reg] gives True.

Examples

open allclose all

Basic Examples  (3)

Test whether a particular point is in a region:

Get conditions for point membership:

Create RegionMemberFunction to apply to different points:

Scope  (21)

Basic Uses  (4)

Directly test whether a point is in a region:

Directly test whether a list of points is in a region:

Get conditions for point membership by using variables {x,y}:

Create RegionMemberFunction to apply to different points:

Special Regions  (6)

Regions in :

Regions in :

Visualize region membership in :

Get the region bounds:

Uniformly sample over the bounding box for the region:

Regions in :

Visualize region membership in :

Regions in :

Formula Regions  (3)

Implicit regions:

Visualize region membership in :

Get the region bounds:

Uniformly sample over the bounding box for the region:

Parametric regions:

Mesh Regions  (4)

MeshRegion in 2D:

In 3D:

BoundaryMeshRegion in 2D:

BoundaryMeshRegion in 3D:

Derived Regions  (4)

RegionIntersection of two regions:

Get the region bounds:

Uniformly sample over the bounding box for the region:

RegionUnion of mixed-dimensional regions:

TransformedRegion:

RegionBoundary:

Applications  (6)

Basic  (2)

Convert polygon data for the given country to a MeshRegion:

Determine membership of a city:

For a parameterized region, RegionMember can give conditions on the parameters to determine when a given point is a member:

Find an instance where the region includes the point:

Visualize it:

Random Points in a Region  (2)

Generate points on a region by filtering a uniform set of points:

Get the region bounds:

Uniformly sample over the bounding box of the region:

Select member points:

Visualize member points:

Convert polygon data for the given country to a MeshRegion:

Get the region bounds:

Uniformly sample over the bounding box of the region:

Monte Carlo Integration  (2)

Perform Monte Carlo integration to estimate the area of a unit disk:

Get the region bounds:

Uniformly sample over the bounding box of the region:

Count the number of samples inside the region:

Get the ratio of samples inside the region to the total number of sample points:

Get the bounding area:

Get the approximate area of the region:

Use random points in a region to perform Monte Carlo integration:

Evaluate a function at each sample point and take their average:

Compare with the exact value:

Properties & Relations  (5)

Element can be used to test region membership for constant regions:

RegionDistance is 0 for a member:

SignedRegionDistance is non-positive for a member:

SignedRegionDistance is positive for a non-member:

Use RegionNearest to find the nearest member:

Visualize it:

Use FindInstance to find multiple instances for special and formula regions:

Find points that are in both regions:

Introduced in 2014
 (10.0)