Документация Engee

Visualization

Страница в процессе перевода.

The package exports a single viz command that can be used to add objects to the scene with a consistent set of options.

viz(object; [options])

Visualize Meshes.jl object with various options.

Available options

  • color - color of geometries

  • alpha - transparency in [0,1]

  • colormap - color scheme/map from ColorSchemes.jl

  • colorrange - minimum and maximum color values

  • showsegments - visualize segments

  • segmentcolor - color of segments

  • segmentsize - width of segments

  • showpoints - visualize points

  • pointmarker - marker of points

  • pointcolor - color of points

  • pointsize - size of points

The option color can be a single scalar or a vector of scalars. For Mesh subtypes, the length of the vector of colors determines if the colors should be assigned to vertices or to elements.

Examples

Different coloring methods (vertex vs. element):

# vertex coloring (i.e. linear interpolation)
viz(mesh, color = 1:nvertices(mesh))

# element coloring (i.e. discrete colors)
viz(mesh, color = 1:nelements(mesh))

Different strategies to show the boundary of geometries (showsegments vs. boundary):

# visualize boundary with showsegments
viz(polygon, showsegments = true)

# visualize boundary with separate call
viz(polygon)
viz!(boundary(polygon))

Notes

  • This function will only work in the presence of a Makie.jl backend via package extensions in Julia v1.9 or later versions of the language.

viz!(object; [options])

Visualize Meshes.jl object in an existing scene with options forwarded to viz.

Geometries

We can visualize a single geometry or multiple geometries in a vector:

triangles = rand(Triangle, 10, crs=Cartesian2D)

viz(triangles, color = 1:10)
ICgiDz74oGr16enp+uDdd9+9c+dOt9ttt9sTEhISExMLCgqeffbZxsbGp59+eqF8qwQALCInJ6ewsFC9FiiY0+lUfX7t2rWB45GuFzHLpmnafM8BAAAAADAP+JASAAAAACyKQAgAAAAAFkUgBAAAAACLIhACAAAAgEURCAEAAADAogiEAAAAAGBRBEIAAAAAsCgCIQAAAABYFIEQAAAAACyKQAgAAAAAFkUgBAAAAACLIhACAAAAgEURCAEAAADAogiEAAAAAGBRBEIAAAAAsCgCIQAAAABYFIEQAAAAACyKQAgAAAAAFkUgBAAAAACLIhACAAAAgEURCAEAAADAogiEAAAAAGBRBEIAAAAAsCgCIQAAAABYFIEQAAAAACyKQAgAAAAAFkUgBAAAAACLIhACAAAAgEURCAEAAADAogiEAAAAAGBRBEIAAAAAsCgCIQAAAABYFIEQAAAAACyKQAgAAAAAFvUf+miXFlQ0QkoAAAAASUVORK5CYII=

Domains

Alternatively, we can visualize domains with topological information such as Mesh and show facets efficiently:

grid = CartesianGrid(10, 10, 10)

viz(grid, showsegments = true, segmentcolor = :teal)
3er3dqhAA0MMYOwEA6Kharfbuu++aTKYLFy4wY12Xy+WuXLkiSVIoFBoZGanX68lkcn19XQjhcDhefvlll8vV7RoBAL2JQAgA6LRmsynLck9OGnxq2Wz2xo0bhUKh9YjFYgkGg8FgkG8UAOD4EAgBAHhWbG1tZbNZSZKcTufIyIjJZOp2RQCAHkcgBAAAAACDYhcKAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwKAIhAAAAABgUgRAAAAAADIpACAAAAAAGRSAEAAAAAIMiEAIAAACAQREIAQAAAMCgCIQAAAAAYFAEQgAAAAAwqP8PRYW2oqIxVi8AAAAASUVORK5CYII=