DiscretizeGraphics

DiscretizeGraphics[g]

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

Examples

open allclose all

Basic Examples  (2)

Discretize a 2D special region including Circle:

Parallelogram:

Discretize 3D special regions including Cone:

Prism:

Scope  (17)

Graphics  (9)

Discretize a 2D special region including Circle:

Parallelogram:

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

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

Discretize only those primitives that match a pattern:

Discretize primitives with dimension less than 2:

Discretize All primitives:

Bounded piecewise linear Graphics primitives can be represented exactly:

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

Nonlinear Graphics primitives can only be approximately represented:

Graphics involving GraphicsComplex:

Use MaxCellMeasure to control the level of discretization:

Graphics3D  (8)

Discretize 3D special regions including Cone:

Prism:

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

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

Discretize only those primitives that match a pattern:

Discretize primitives with dimension less than 2:

Discretize All primitives:

Bounded piecewise linear Graphics3D primitives can be represented exactly:

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

Nonlinear Graphics3D primitives can only be approximately represented:

Use MaxCellMeasure to control the level of discretization:

Options  (23)

MaxCellMeasure  (6)

Discretize with a maximum cell area of 0.1:

This gives the area of the cells:

Discretize with a maximum cell volume of 0.1:

A Histogram of the cell volumes:

Compare different length settings:

Compare different area settings:

Compare different face area settings:

Compare different volume settings:

MeshCellHighlight  (2)

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

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 parallelogram:

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  (2)

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

Individual cells can be highlighted using their cell index:

Or by the cell itself:

PlotRange  (5)

Automatic includes the entire range of a finite region:

Automatic includes a partial range of an infinite region:

Explicit settings are respected:

Unless overridden:

Focus region of interest:

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

Compare different settings:

PlotTheme  (2)

Use a theme with grid lines and a legend:

Use a theme to draw a wireframe:

Applications  (4)

Compute the length of a curve by converting it to a geometric region:

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

Convert Text to a geometric region:

Convert a country polygon to a geometric region:

Properties & Relations  (9)

Multiple primitives are interpreted as a union:

Bounded linear primitives can be exactly discretized:

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

Nonlinear primitives can only be approximately discretized:

Use BoundaryDiscretizeGraphics to get a BoundaryMeshRegion representation:

DiscretizeRegion can be used to discretize any RegionQ object:

DiscretizeGraphics can be used to discretize Graphics and Graphics3D objects:

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

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

Compute directly with the region:

Or with its discretized version:

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

Image discretizes any rendered expression to an Image object:

Possible Issues  (4)

Primitives with Scaled coordinates are not discretized:

Primitives with Offset coordinates are not discretized:

Primitives with ImageScaled coordinates are not discretized:

DiscretizeGraphics for Graphics3D with multiple volume primitives is not supported:

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).

CMS

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

BibTeX

@misc{reference.wolfram_2024_discretizegraphics, author="Wolfram Research", title="{DiscretizeGraphics}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/DiscretizeGraphics.html}", note=[Accessed: 21-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_discretizegraphics, organization={Wolfram Research}, title={DiscretizeGraphics}, year={2015}, url={https://reference.wolfram.com/language/ref/DiscretizeGraphics.html}, note=[Accessed: 21-December-2024 ]}