# Understanding Meshes and GeoTables visualisation capabilities

**URL:** <https://discourse.julialang.org/t/understanding-meshes-and-geotables-visualisation-capabilities/110353>\
**Category:** General Usage\
**Tags:** meshes, viz\
**Created:** [February 17, 2024, 6:30pm UTC](https://discourse.julialang.org/t/understanding-meshes-and-geotables-visualisation-capabilities/110353 "2024-02-17T18:30:52Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [February 21, 2024, 10:45pm UTC](https://discourse.julialang.org/t/understanding-meshes-and-geotables-visualisation-capabilities/110353/10 "2024-02-21T22:45:01Z")

</div>

> [@BambOoxX](#):
>
> My question is : is it possible to (or more likely how hard is it) to add application-specific element types for storage in a `GeoTable` and for visualization with `viz`

You can add a new geometry in Meshes.jl in a PR, and it will automatically work with the GeoTable, viz, etc.

> [@BambOoxX](#):
>
> As an example, I just may want to plot arrows or pyramids based on a geotable with specific elements. Question is, how can one write the proper recipe for that, should I just add some `Makie` based recipes, or does it make sense to rely on `viz` or else…

You can already do that by creating `Ray` and `Pyramid` geometries for example. You can place all these geometries into a `GeometrySet` and that will be a valid `Domain`. The `Mesh` is a specific subtype of `Domain` that is described in terms of `vertices`, `connectivities`, etc.

```julia
julia> using Meshes

julia> r = rand(Ray{3,Float64})
Ray{3,Float64}
├─ p: Point(0.8544621114647082, 0.007290166206372128, 0.8953959324059896)
└─ v: Vec(0.9568652328665942, 0.611726781018889, 0.27683459777111596)

julia> p = rand(Pyramid{3,Float64})
Pyramid{3,Float64}
├─ Point(0.5245605139763986, 0.31180747839374345, 0.8006794534270958)
├─ Point(0.17999965079093627, 0.2960387752699939, 0.23121858402483375)
├─ Point(0.16164742029403556, 0.5896417963031546, 0.0005634795956463989)
├─ Point(0.5200829045516021, 0.23759556572538754, 0.36635011529535155)
└─ Point(0.8140821418410266, 0.522107532502354, 0.5031798558753174)

julia> d = GeometrySet([r, p])
2 GeometrySet{3,Float64}
├─ Ray(p: (0.854462, 0.00729017, 0.895396), v: (0.956865, 0.611727, 0.276835))
└─ Pyramid((0.524561, 0.311807, 0.800679), ..., (0.814082, 0.522108, 0.50318))

julia> import GLMakie as Mke

julia> viz(rand(Ray{3,Float64}, 100))

```

![image](https://global.discourse-cdn.com/julialang/original/3X/7/8/78ea2a1672651dfbbd87ef89fb1941c6bd560cca.png)

> [@BambOoxX](#):
>
> FYI, my environment is completely up to date, but the points plotted with `viz` look transparent. I thought that could be just a `z`-level problem/artifact during the plotting, but the additional `scatter` does not suffer from that it seems. Regarding the markers themselves, I was wondering why `scatter` was preferred evend for 3D data plots, instead of `meshscatter`.

Here is the full recipe to plot a `PointSet`, which is constructed when you ask to `viz` the `vertices` of the mesh:

> <https://github.com/JuliaGeometry/Meshes.jl/blob/4a0d73fb7ba6f010f4e55bad152e0a61166302b2/ext/geometryset.jl#L68-L84>

We simply call `Makie.scatter` with the `overdraw=true` keyword to address issues with large point sets, see [Hide stroke in 3D scatter using Makie.jl](https://discourse.julialang.org/t/hide-stroke-in-3d-scatter-using-makie-jl/106383).

> [@BambOoxX](#):
>
> is it possible to define coordinate transformations on the domain based on information in the table of a geotable ? As far as I understood from the book, you propose coordinate transforms, that modify the domain with scalar transforms (1 for the whole mesh e.g. rotation or translation), but no coordinate transforms that can use the information in the table, do you ?

The `CoordinateTransform` is a special case of `GeometricTransform` that simply applies the same function to each point of the domain individually. These transforms are defined in terms of parameters, they do not live in the columns of the `GeoTable`. If you want to design a transform that takes both the `values` and the `domain` of the `GeoTable`, then you are after a general `TableTransform`. See the hierarchy of transforms here: [Transforms · GeoStats.jl](https://juliaearth.github.io/GeoStatsDocs/stable/transforms.html)

I think the easiest way forward is to start adding missing geometries in Meshes.jl, then trying to visualize them. After that, we can come up with higher-level transforms that meet your requirements, and a find a good home for them. Meshes.jl only defines `GeometricTransform` that act on the `domain` only, they don’t have access to the table of features.

---

_[View the full topic](https://discourse.julialang.org/t/understanding-meshes-and-geotables-visualisation-capabilities/110353)._
