DiscretizeGraphics
✖
DiscretizeGraphics
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 PrecisionGoal->p, 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 allBasic Examples (2)Summary of the most common use cases
Discretize a 2D special region including Circle:

https://wolfram.com/xid/0btnx65hoeky-bjy8c0


https://wolfram.com/xid/0btnx65hoeky-huituq

Discretize 3D special regions including Cone:

https://wolfram.com/xid/0btnx65hoeky-td2y4


https://wolfram.com/xid/0btnx65hoeky-9wnaw

Scope (17)Survey of the scope of standard use cases
Graphics (9)
Discretize a 2D special region including Circle:

https://wolfram.com/xid/0btnx65hoeky-cn5c9s


https://wolfram.com/xid/0btnx65hoeky-pbwdl0

Discretize Graphics with GraphicsComplex containing Point, Line, and Polygon:

https://wolfram.com/xid/0btnx65hoeky-mjjnlr

https://wolfram.com/xid/0btnx65hoeky-60h0x6


https://wolfram.com/xid/0btnx65hoeky-ctn6n1

Discretize Graphics with GraphicsComplex containing Rectangle, Circle, and Disk:

https://wolfram.com/xid/0btnx65hoeky-9mv8fx

https://wolfram.com/xid/0btnx65hoeky-q8iwzm


https://wolfram.com/xid/0btnx65hoeky-eul0rk

Discretize only those primitives that match a pattern:

https://wolfram.com/xid/0btnx65hoeky-m9ql1p


https://wolfram.com/xid/0btnx65hoeky-kcvtxt

Discretize primitives with dimension less than 2:

https://wolfram.com/xid/0btnx65hoeky-732s3

Discretize All primitives:

https://wolfram.com/xid/0btnx65hoeky-4fkags

Bounded piecewise linear Graphics primitives can be represented exactly:

https://wolfram.com/xid/0btnx65hoeky-rfdrhg


https://wolfram.com/xid/0btnx65hoeky-0w5hfu

Unbounded piecewise linear Graphics primitives can only be represented within a finite range:

https://wolfram.com/xid/0btnx65hoeky-f76ve5

https://wolfram.com/xid/0btnx65hoeky-ldrl72


https://wolfram.com/xid/0btnx65hoeky-8y5iru

Nonlinear Graphics primitives can only be approximately represented:

https://wolfram.com/xid/0btnx65hoeky-bmstpy


https://wolfram.com/xid/0btnx65hoeky-bh8ncy

Graphics involving GraphicsComplex:

https://wolfram.com/xid/0btnx65hoeky-z7s3m2

https://wolfram.com/xid/0btnx65hoeky-pkwko1


https://wolfram.com/xid/0btnx65hoeky-wtrrmh

Use MaxCellMeasure to control the level of discretization:

https://wolfram.com/xid/0btnx65hoeky-h921gw


https://wolfram.com/xid/0btnx65hoeky-ton9s8

Graphics3D (8)
Discretize 3D special regions including Cone:

https://wolfram.com/xid/0btnx65hoeky-bucx9i


https://wolfram.com/xid/0btnx65hoeky-oulcae

Discretize Graphics3D with GraphicsComplex containing Point, Line, and Polygon:

https://wolfram.com/xid/0btnx65hoeky-oj5cw

https://wolfram.com/xid/0btnx65hoeky-374by


https://wolfram.com/xid/0btnx65hoeky-nl3uc

Discretize a whole Graphics3D scene, where multiple primitives are taken as a union:

https://wolfram.com/xid/0btnx65hoeky-c7gd1s


https://wolfram.com/xid/0btnx65hoeky-9hn7nw

Discretize only those primitives that match a pattern:

https://wolfram.com/xid/0btnx65hoeky-ujkess

https://wolfram.com/xid/0btnx65hoeky-xq5kzl


https://wolfram.com/xid/0btnx65hoeky-olfngn

Discretize primitives with dimension less than 2:

https://wolfram.com/xid/0btnx65hoeky-l6u82k

Discretize All primitives:

https://wolfram.com/xid/0btnx65hoeky-nm88in

Bounded piecewise linear Graphics3D primitives can be represented exactly:

https://wolfram.com/xid/0btnx65hoeky-bw9jbk

https://wolfram.com/xid/0btnx65hoeky-0tz0pz


https://wolfram.com/xid/0btnx65hoeky-m79bw9

Unbounded Graphics3D primitives can only be represented within a finite range:

https://wolfram.com/xid/0btnx65hoeky-j6gq2b

https://wolfram.com/xid/0btnx65hoeky-c4jepp


https://wolfram.com/xid/0btnx65hoeky-qvs473

Nonlinear Graphics3D primitives can only be approximately represented:

https://wolfram.com/xid/0btnx65hoeky-m5o8bq


https://wolfram.com/xid/0btnx65hoeky-9ei9to

Use MaxCellMeasure to control the level of discretization:

https://wolfram.com/xid/0btnx65hoeky-v61brv


https://wolfram.com/xid/0btnx65hoeky-5uvgux

Options (23)Common values & functionality for each option
MaxCellMeasure (6)
Discretize with a maximum cell area of 0.1:

https://wolfram.com/xid/0btnx65hoeky-kbjrf2

This gives the area of the cells:

https://wolfram.com/xid/0btnx65hoeky-dqnjgp

Discretize with a maximum cell volume of 0.1:

https://wolfram.com/xid/0btnx65hoeky-rxviz5


https://wolfram.com/xid/0btnx65hoeky-bcyrmf

A Histogram of the cell volumes:

https://wolfram.com/xid/0btnx65hoeky-hbdiv7

Compare different length settings:

https://wolfram.com/xid/0btnx65hoeky-k3uvx2


https://wolfram.com/xid/0btnx65hoeky-tqxl8o

Compare different area settings:

https://wolfram.com/xid/0btnx65hoeky-dqk74h


https://wolfram.com/xid/0btnx65hoeky-3ky95e

Compare different face area settings:

https://wolfram.com/xid/0btnx65hoeky-6bwxok


https://wolfram.com/xid/0btnx65hoeky-5ctri2

Compare different volume settings:

https://wolfram.com/xid/0btnx65hoeky-2sabbt


https://wolfram.com/xid/0btnx65hoeky-yxh1v4

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

https://wolfram.com/xid/0btnx65hoeky-y7md78

Individual cells can be highlighted using their cell index:

https://wolfram.com/xid/0btnx65hoeky-dm25kz


https://wolfram.com/xid/0btnx65hoeky-m0ew3d

MeshCellLabel (3)
MeshCellLabel can be used to label parts of a MeshRegion:

https://wolfram.com/xid/0btnx65hoeky-s9ph0b

Label the vertices and edges of a parallelogram:

https://wolfram.com/xid/0btnx65hoeky-zmtbyv

Individual cells can be labeled using their cell index:

https://wolfram.com/xid/0btnx65hoeky-0uczwb


https://wolfram.com/xid/0btnx65hoeky-ri0ks8

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

https://wolfram.com/xid/0btnx65hoeky-gx4i29

Use MeshCellLabel to show the markers:

https://wolfram.com/xid/0btnx65hoeky-2dvjay

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

https://wolfram.com/xid/0btnx65hoeky-fy2u6n

Individual cells can be drawn using their cell index:

https://wolfram.com/xid/0btnx65hoeky-z0ybhq


https://wolfram.com/xid/0btnx65hoeky-kl6pkr

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

https://wolfram.com/xid/0btnx65hoeky-j885nh

Individual cells can be highlighted using their cell index:

https://wolfram.com/xid/0btnx65hoeky-1kn8l4


https://wolfram.com/xid/0btnx65hoeky-la4r57

PlotRange (5)
Automatic includes the entire range of a finite region:

https://wolfram.com/xid/0btnx65hoeky-dj7jsu

https://wolfram.com/xid/0btnx65hoeky-y0bmfk

Automatic includes a partial range of an infinite region:

https://wolfram.com/xid/0btnx65hoeky-b1jfk3

https://wolfram.com/xid/0btnx65hoeky-eni50e

Explicit settings are respected:

https://wolfram.com/xid/0btnx65hoeky-tg3ruw


https://wolfram.com/xid/0btnx65hoeky-kvp8of


https://wolfram.com/xid/0btnx65hoeky-ip8xf2


https://wolfram.com/xid/0btnx65hoeky-fp9wwp

https://wolfram.com/xid/0btnx65hoeky-znd96p

Clipping a solid primitive results in a solid primitive; otherwise, interiors are exposed:

https://wolfram.com/xid/0btnx65hoeky-nbyvhw


https://wolfram.com/xid/0btnx65hoeky-67gdv2


https://wolfram.com/xid/0btnx65hoeky-9jasgg

https://wolfram.com/xid/0btnx65hoeky-eumnvq

Applications (4)Sample problems that can be solved with this function
Compute the length of a curve by converting it to a geometric region:

https://wolfram.com/xid/0btnx65hoeky-hnag14

https://wolfram.com/xid/0btnx65hoeky-8rokjp


https://wolfram.com/xid/0btnx65hoeky-d03xoi

Compute the surface area of a graphic by converting it to a geometric region:

https://wolfram.com/xid/0btnx65hoeky-gyy4sm

https://wolfram.com/xid/0btnx65hoeky-jb4pqc


https://wolfram.com/xid/0btnx65hoeky-l1mcma

Convert Text to a geometric region:

https://wolfram.com/xid/0btnx65hoeky-uxqlpw


https://wolfram.com/xid/0btnx65hoeky-swxgh8

Convert a country polygon to a geometric region:

https://wolfram.com/xid/0btnx65hoeky-umh202

Properties & Relations (9)Properties of the function, and connections to other functions
Multiple primitives are interpreted as a union:

https://wolfram.com/xid/0btnx65hoeky-4byzvq


https://wolfram.com/xid/0btnx65hoeky-feybfg

Bounded linear primitives can be exactly discretized:

https://wolfram.com/xid/0btnx65hoeky-ws0rif


https://wolfram.com/xid/0btnx65hoeky-5d3ypi

Unbounded linear primitives can only be represented within a finite range:

https://wolfram.com/xid/0btnx65hoeky-iidegh


https://wolfram.com/xid/0btnx65hoeky-z3qcrq

Nonlinear primitives can only be approximately discretized:

https://wolfram.com/xid/0btnx65hoeky-iegp0q


https://wolfram.com/xid/0btnx65hoeky-1d4p36

Use BoundaryDiscretizeGraphics to get a BoundaryMeshRegion representation:

https://wolfram.com/xid/0btnx65hoeky-n7pv58


https://wolfram.com/xid/0btnx65hoeky-vigtll


https://wolfram.com/xid/0btnx65hoeky-gjy97k

DiscretizeRegion can be used to discretize any RegionQ object:

https://wolfram.com/xid/0btnx65hoeky-b3mus0

DiscretizeGraphics can be used to discretize Graphics and Graphics3D objects:

https://wolfram.com/xid/0btnx65hoeky-f7ytbg

They can both discretize special regions that are also graphics primitives:

https://wolfram.com/xid/0btnx65hoeky-cwkxhn

Graphics primitives that are also geometric regions can be used without discretization:

https://wolfram.com/xid/0btnx65hoeky-sw9glw

https://wolfram.com/xid/0btnx65hoeky-b0asgz

Compute directly with the region:

https://wolfram.com/xid/0btnx65hoeky-e4o0vw

Or with its discretized version:

https://wolfram.com/xid/0btnx65hoeky-jsmpxo

Rasterize discretizes any rendered expression to Graphics containing a Raster object:

https://wolfram.com/xid/0btnx65hoeky-3nxtb4


https://wolfram.com/xid/0btnx65hoeky-jnlcrl

Image discretizes any rendered expression to an Image object:

https://wolfram.com/xid/0btnx65hoeky-b0rlc8


https://wolfram.com/xid/0btnx65hoeky-cfanh1

Possible Issues (4)Common pitfalls and unexpected behavior
Primitives with Scaled coordinates are not discretized:

https://wolfram.com/xid/0btnx65hoeky-b6jh2f


https://wolfram.com/xid/0btnx65hoeky-46e8sb

Primitives with Offset coordinates are not discretized:

https://wolfram.com/xid/0btnx65hoeky-jlamw1


https://wolfram.com/xid/0btnx65hoeky-2rmx4q

Primitives with ImageScaled coordinates are not discretized:

https://wolfram.com/xid/0btnx65hoeky-sva3i9


https://wolfram.com/xid/0btnx65hoeky-r0cje5



DiscretizeGraphics for Graphics3D with multiple volume primitives is not supported:

https://wolfram.com/xid/0btnx65hoeky-bdszx2


https://wolfram.com/xid/0btnx65hoeky-tcx9nh


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