DiscretizeRegion

DiscretizeRegion[reg]

discretizes a region reg into a MeshRegion.

DiscretizeRegion[reg,{{xmin,xmax},}]

restricts to the bounds .

Details and Options

Examples

open all close all

Basic Examples  (3)

Discretize 1D embedded regions:

Restrict to :

Mixed-dimension region:

Discretize 2D embedded regions:

Restrict to the first quadrant:

Mixed-dimension region:

Discretize 3D embedded regions:

Restrict to the first orthant:

Restrict to :

Scope  (30)

Regions in 1D  (5)

Point and Line are special regions that can exist in 1D:

Line:

An ImplicitRegion is 1D if it has only one variable:

Because this region is unbounded, clip it to discretize:

A ParametricRegion is 1D if it has only one function:

The discretization can be clipped to a specified range:

Because this region is unbounded, clip it to discretize:

A BooleanRegion in 1D:

A region can include components of different dimensions:

Separate the components by dimension:

Regions in 2D  (8)

Point, Circle, and Rectangle are special regions that can exist in 2D:

Circle is 1D, but embedded in 2D:

Rectangle is 2D:

An ImplicitRegion is 2D if it has two variables. A 1D region is typically an equation:

A 2D region is typically a combination of inequalities:

For an unbounded region, clip the discretization to a specified range:

A ParametricRegion is 2D if it has two functions. A 1D region has one parameter:

A 2D region has two parameters:

Clip the region:

A 2D parametric region with parameters constrained to a unit disk:

When the parameters are constrained to just the unit circle, the result is 1D:

Parameters may be members of mixed-dimension regions:

Given two exact regions, ParametricRegion can be used to represent their Minkowski sum:

A RegionUnion in 2D:

A region can include components of different dimensions:

Separate the components by dimension:

A polygon with GeoGridPosition:

A polygon with GeoPosition:

Regions in 3D  (8)

Point, Line, Polygon, and Ellipsoid are special regions that can exist in 3D:

Line:

Polygon:

Ellipsoid:

An ImplicitRegion is 3D if it has three variables. A 2D region is typically an equation:

Clip an unbounded region to discretize it:

A ParametricRegion with 3 functions and a 3D parameters space is a 3D solid:

A ParametricRegion with 3 functions and a 2D parameter space is a surface embedded in 3D:

Parameters constrained to the lower surface of a sphere are in a 2D parameter space:

A ParametricRegion with 3 functions and a 1D parameter space is a curve embedded in 3D:

The parameters can be part of mixed-dimension region:

Discretize a ParametricRegion where the parameters are in a mixed-dimension region:

The result has 1D, 2D, and 3D components:

Given two exact regions, ParametricRegion can be used to represent their Minkowski sum:

A region can include components of different dimensions:

Detail  (2)

The measure of cells in the discretization can be controlled using MaxCellMeasure:

By default, when given as a number, it applies to the embedding dimension:

A particular dimension may be specified explicitly:

For nonlinear regions the measure of boundary cells depends on several options:

The length of any segment may be controlled by MaxCellMeasure:

The default PrecisionGoal is chosen to be a value so that curves appear as visually smooth:

PrecisionGoal->None may be used to base the boundary measure on MaxCellMeasure:

AccuracyGoal->a may be used to specify an absolute tolerance :

The default is for MaxCellMeasure to apply to the embedding dimension:

The measure on the boundary may be further restricted by approximation requirements:

Quality  (7)

The measure of cells in the discretization can be controlled using MaxCellMeasure:

By default, this applies only to full-dimensional cells:

MaxCellMeasure can also control the size of lower-dimensional cells:

Controlling face size in 3D:

The quality of cells in the discretization can be controlled using MeshQualityGoal:

The goal can also be set to "Minimal" or "Maximal":

MeshRefinementFunction can be used to refine a discretization based on a function:

Add a refinement function to refine triangles in the upper-left quadrant:

Use AccuracyGoal to ensure the discretized boundary is close to the exact boundary:

The discretization with the higher AccuracyGoal is closer to the true boundary:

Use PrecisionGoal to ensure the discretized boundary is close to the exact boundary:

The discretization with the higher PrecisionGoal is closer to the true boundary:

Set PerformanceGoal to "Quality" for a high-quality discretization:

Or to "Speed" for a faster discretization that may be of lower quality:

Options  (28)

AccuracyGoal  (1)

Use AccuracyGoal to ensure the discretized boundary is close to the exact boundary:

The discretization with the higher AccuracyGoal is closer to the true boundary:

MaxCellMeasure  (4)

Discretize a polygon using the Automatic setting for MaxCellMeasure:

Specify a minimal triangulation by not constraining cell measure:

Specify a maximum cell area:

This gives the areas of the triangles:

Specify a maximum length for line segments:

A Histogram of the line segment lengths:

In 3D, specify a maximum area for faces:

A Histogram of the face areas:

MeshCellHighlight  (3)

MeshCellHighlight allows you to specify highlighting for parts of a MeshRegion:

By making faces transparent, the internal structure of a 3D MeshRegion can be seen:

Individual cells can be highlighted using their cell index:

Or by the cell itself:

MeshCellLabel  (3)

MeshCellLabel can be used to label parts of a MeshRegion:

Label the vertices and edges of a polygon:

Individual cells can be labeled using their cell index:

Or by the cell itself:

MeshCellMarker  (1)

MeshCellMarker can be used to assign values to parts of a MeshRegion:

Use MeshCellLabel to show the markers:

MeshCellShapeFunction  (2)

MeshCellShapeFunction allows you to specify functions for parts of a MeshRegion:

Individual cells can be drawn using their cell index:

Or by the cell itself:

MeshCellStyle  (3)

MeshCellStyle allows you to specify styling for parts of a MeshRegion:

By making faces transparent, the internal structure of a 3D MeshRegion can be seen:

Individual cells can be styled using their cell index:

Or by the cell itself:

MeshRefinementFunction  (2)

Get a mesh of the unit disk that is finer in the center:

Refine an interval so that the spacing is finer in the left half:

Method  (6)

The "Continuation" method uses a curve continuation method that can in many cases resolve corners, cusps, and sharp changes quite well:

The "RegionPlot" method is based on improving output from RegionPlot and can sometimes be faster:

The "Boolean" method is optimized for Boolean regions:

The "DiscretizeGraphics" method is optimized for graphics primitives:

The "RegionPlot3D" method for 3D regions is based on RegionPlot3D:

The "ContourPlot3D" method for 3D regions is based on ContourPlot3D:

PlotTheme  (2)

Use a theme with grid lines and a legend:

Use a theme to draw a wireframe:

PrecisionGoal  (1)

Use PrecisionGoal to ensure the discretized boundary is close to the exact boundary:

The discretization with the higher PrecisionGoal is closer to the true boundary:

Applications  (2)

Visualize LaminaData:

Discretize and visualize the region:

Visualize SolidData:

Discretize and visualize the region:

Properties & Relations  (5)

The output of DiscretizeRegion is a MeshRegion:

TriangulateMesh can be used to re-discretize a MeshRegion:

Only discretizing the original region can more accurately discretize the boundary, though:

Applied to a MeshRegion, DiscretizeRegion is the same as TriangulateMesh:

DiscretizeRegion can discretize a region with holes:

DiscretizeRegion can discretize a region with disjoint components:

Neat Examples  (2)

Discretize an implicit Lissajous region:

Get the discretized regions of various car manufacturer logos:

Introduced in 2014
 (10.0)
 |
Updated in 2015
 (10.2)