DiscretizeGraphics

discretizes a 2D or 3D graphic g into a MeshRegion.

DiscretizeGraphics[g,patt]

discretizes only the elements in g that match the pattern patt.

Details and Options

• DiscretizeGraphics discretizes graphics into a disjoint union of piecewise linear cells used in MeshRegion.
• The graphic g can be Graphics, Graphics3D, or individual graphics primitives.
• DiscretizeGraphics effectively treats multiple primitives in Graphics and Graphics3D as a union operation.
• The discretization is exact when g contains only bounded piecewise linear primitives; otherwise, it is an approximation.
• Bounded piecewise linear primitives in Graphics (these can be represented exactly):
•  Point[…] point (0D) Line[…] line (1D) Triangle[…] filled triangle (2D) Polygon[…] filled polygon (2D) Rectangle[…] filled rectangle (2D) Parallelogram[…] filled parallelogram (0D, 1D, or 2D) Simplex[…] simplex (0D, 1D, or 2D)
• In addition, SSSTriangle, SASTriangle, ASATriangle, and AASTriangle evaluate to Triangle and can be represented exactly.
• Unbounded piecewise linear primitives in Graphics (only a finite range can be represented):
•  HalfLine[…] half-line or ray (1D) InfiniteLine[…] infinite line (1D) HalfPlane[…] half-space (2D) ConicHullRegion[…] linear cone (0D, 1D, or 2D)
• Nonlinear primitives in Graphics (only an approximation can be represented):
•  Circle[…] circle, ellipse, sectors (1D) Disk[…] disk, filled ellipse, sectors (2D) BezierCurve[…] Bezier spline curve (1D) BSplineCurve[…] B-spline curve (1D) JoinedCurve[…] joined curve segments (1D) FilledCurve[…] filled closed curve (2D)
• In addition, Circumsphere evaluates to Sphere and can be represented approximately.
• Bounded piecewise linear primitives in Graphics3D (these can be represented exactly):
•  Point[…] point (0D) Line[…] line (1D) Triangle[…] filled triangle (2D) Polygon[…] filled polygon (2D) Cuboid[…] filled cuboid (3D) Parallelepiped[…] filled parallelepiped (0D, 1D, 2D, or 3D) Tetrahedron[…] filled tetrahedron (3D) Hexahedron[…] filled hexahedron (3D) Pyramid[…] filled pyramid (3D) Prism[…] filled prism (3D) Simplex[…] simplex (0D, 1D, 2D, or 3D)
• Unbounded piecewise linear primitives in Graphics3D (only a finite range can be represented):
•  HalfLine[…] half-line or ray (1D) InfiniteLine[…] infinite line (1D) HalfPlane[…] plane bounded in one direction (2D) InfinitePlane[…] infinite plane (3D) ConicHullRegion[…] linear cone (0D, 1D, 2D, or 3D)
• Nonlinear primitives in Graphics3D (only an approximation can be represented):
•  BezierCurve[…] Bezier curve (1D) BSplineCurve[…] B-spline curve (1D) JoinedCurve[…] joined curve segments (1D) BSplineSurface[…] B-spline surface (2D) Sphere[…] sphere (2D) Ball[…] ball or filled sphere (3D) Ellipsoid[…] filled ellipsoid (3D) Cylinder[…] filled cylinder (3D) Cone[…] filled cone (3D)
• In addition, Circumsphere evaluates to Sphere and can be represented approximately.
• DiscretizeGraphics has the same options as MeshRegion, with the following additions and changes:
•  AccuracyGoal Automatic digits of accuracy sought MaxCellMeasure Automatic maximum cell measure MeshQualityGoal Automatic quality goal for mesh cells Method Automatic method to use MeshRefinementFunction None function that returns True if a mesh cell needs refinement PlotRange Automatic the range to include PerformanceGoal \$PerformanceGoal whether to consider speed or quality PrecisionGoal Automatic digits of precision sought
• With AccuracyGoal->a and , an attempt will be made to keep the maximum distance between the region reg or the discretized region dreg and any point in RegionSymmetricDifference[reg,dreg] to less than , where is the length of the diagonal of the plot range.

Examples

open allclose all

Basic Examples(2)

Discretize a 2D special region including Circle:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

Discretize 3D special regions including Cone:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=