You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/meshes.md
+105-4Lines changed: 105 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,10 @@
1
1
# Meshes
2
2
3
+
```@setup 1
4
+
using Bonito
5
+
Page()
6
+
```
7
+
3
8
GeometryBasics defines two mesh types to work with - `Mesh` and `MetaMesh`
4
9
5
10
## Mesh
@@ -17,6 +22,48 @@ You can get data from a mesh using a few interface functions:
17
22
18
23
You can also grab the contents of `mesh.vertex_attributes` as if they were fields of the `Mesh`, e.g. `mesh.position` works.
19
24
25
+
### Custom Attributes
26
+
27
+
Meshes support arbitrary custom attributes beyond the standard position, normal, and UV coordinates. You can attach per-vertex or per-face data like material properties, identifiers, or computed values. These are stored in `mesh.vertex_attributes` and accessed using the same interface.
# Use per_face to create FaceViews for per-face attributes
53
+
mesh = GeometryBasics.mesh(
54
+
points,
55
+
faces,
56
+
material=per_face(materials, faces),
57
+
face_name=per_face(face_names, faces)
58
+
)
59
+
60
+
# Access custom attributes
61
+
mesh.material[2] # Get material of second face
62
+
mesh.face_name[1] # Get name of first face
63
+
```
64
+
65
+
This pattern is useful for physical simulations, rendering with material properties, or tagging mesh regions for analysis.
66
+
20
67
### FaceView
21
68
22
69
@@ -47,6 +94,40 @@ per_face
47
94
MetaMesh
48
95
```
49
96
97
+
`MetaMesh` wraps a `Mesh` and allows you to attach global metadata that applies to the entire mesh rather than individual vertices or faces. This is useful for storing information like source file paths, transformation matrices, object identifiers, or simulation parameters.
0 commit comments