Skip to content

Example: Triangular Mesh Geometry

Jon Drobny edited this page Nov 30, 2021 · 9 revisions

Triangular Meshes for Homogeneous Composition, Complex Objects

Using parry3d, RustBCA has an experimental feature to use full 3D triangular meshes. These are currently limited to homogeneous, single-mesh targets, but compound objects and inhomogeneity are planned features for triangular meshes.

To use this feature, make sure you are on the dev branch. Then, run one of the included examples:

  • cargo run --release --features parry3d TRIMESH examples/tungsten_twist_trimesh.toml
  • cargo run --release --features parry3d TRIMESH examples/tungsten_tiles.toml

These examples can be plotted using rustbca.py (requires toml, shapely, mayavi, numpy, matplotlib):

from scripts.rustbca import *
do_trajectory_plot_3d('tungsten_twist_', input_file='examples/tungsten_twist_trimesh.toml')

Helium trajectories on a twisted and extruded tungsten shape

Hydrogen trajectories on castellated, ITER-like tungsten tiles in 3D

Notes

Note that in order for meshes to work properly in RustBCA, the following must be true:

  • meshes must consist of only triangles
  • meshes must be "watertight"
  • surface normals must point outwards

Watertightness and other mesh properties can be tested with the trimesh library on PyPi.