BoundaryDiscretizeGraphics
discretizes a 2D or 3D graphic g into a BoundaryMeshRegion.
BoundaryDiscretizeGraphics[g,patt]
discretizes only the elements in g that match the pattern patt.
Details and Options
- BoundaryDiscretizeGraphics discretizes full-dimensional graphics primitives into a boundary representation consisting of piecewise linear elements used in BoundaryMeshRegion.
- Only full-dimensional parts (areas in 2D and volumes in 3D) will be discretized.
- The graphic g can be Graphics, Graphics3D, or individual graphics primitives.
- BoundaryDiscretizeGraphics effectively treats multiple primitives in Graphics and Graphics3D as a union operation.
- Bounded piecewise linear primitives in Graphics (these can be represented exactly):
-
Triangle[…] filled triangle (2D) Polygon[…] filled polygon (2D) Rectangle[…] filled rectangle (2D) Parallelogram[…] filled parallelogram (2D) Simplex[…] simplex (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):
-
HalfPlane[…] half-space (2D) ConicHullRegion[…] linear cone (2D) - Nonlinear primitives in Graphics (only an approximation can be represented):
-
Disk[…] disk, filled ellipse, sectors (2D) FilledCurve[…] filled closed curve (2D) - Bounded piecewise linear primitives in Graphics3D (these can be represented exactly):
-
Cuboid[…] filled cuboid (3D) Parallelepiped[…] filled parallelepiped (3D) Tetrahedron[…] filled tetrahedron (3D) Hexahedron[…] filled hexahedron (3D) Pyramid[…] filled pyramid (3D) Prism[…] filled prism (3D) Simplex[…] simplex (3D) - Unbounded piecewise linear primitives in Graphics3D (only a finite range can be represented):
-
ConicHullRegion[…] linear cone (3D) - Nonlinear primitives in Graphics3D (only an approximation can be represented):
-
Ball[…] ball or filled sphere (3D) Ellipsoid[…] filled ellipsoid (3D) Cylinder[…] filled cylinder (3D) Cone[…] filled cone (3D) - BoundaryDiscretizeGraphics has the same options as BoundaryMeshRegion, with the following additions and changes:
-
AccuracyGoal Automatic digits of accuracy sought MaxCellMeasure Automatic maximum cell measure Method Automatic method to use 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 (3)
Scope (15)
Graphics (9)
Discretize a 2D special region including Disk:
Discretize Graphics with GraphicsComplex containing Line and Polygon:
Discretize Graphics with GraphicsComplex containing Rectangle and Disk:
Discretize a whole 2D Graphics scene, where multiple primitives are taken as a union:
Discretize only those primitives that match a pattern:
Discretize primitives with area < 1:
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:
Use MaxCellMeasure to control the level of discretization:
Graphics3D (6)
Discretize 3D special regions including Cone:
3D styling primitives are discarded:
Discretize Graphics3D with GraphicsComplex of Polyhedron:
Bounded piecewise linear Graphics3D primitives can be represented exactly:
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:
Discretize with a maximum edge length of 0.5:
This gives the lengths of the sides:
Discretize with a maximum cell volume of 0.05:
Discretize with a maximum face area of 0.1:
A Histogram of the face areas:
MeshCellHighlight (2)
MeshCellHighlight allows you to specify highlighting for parts of a BoundaryMeshRegion:
MeshCellLabel (3)
MeshCellLabel can be used to label parts of a BoundaryMeshRegion:
Label the vertices and edges of a rectangle:
MeshCellMarker (1)
MeshCellMarker can be used to assign values to parts of a BoundaryMeshRegion:
Use MeshCellLabel to show the markers:
MeshCellShapeFunction (2)
MeshCellShapeFunction allows you to specify functions for parts of a BoundaryMeshRegion:
MeshCellStyle (2)
MeshCellStyle allows you to specify styling for parts of a BoundaryMeshRegion:
PlotRange (5)
Applications (3)
Compute the volume of a graphic by converting it to a geometric region:
Convert Text 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 DiscretizeGraphics to get a MeshRegion representation:
BoundaryDiscretizeRegion can be used to discretize any RegionQ object:
BoundaryDiscretizeGraphics 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 (1)
Primitives with Offset coordinates are not discretized:
Text
Wolfram Research (2014), BoundaryDiscretizeGraphics, Wolfram Language function, https://reference.wolfram.com/language/ref/BoundaryDiscretizeGraphics.html (updated 2015).
CMS
Wolfram Language. 2014. "BoundaryDiscretizeGraphics." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/BoundaryDiscretizeGraphics.html.
APA
Wolfram Language. (2014). BoundaryDiscretizeGraphics. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BoundaryDiscretizeGraphics.html