3MAH / microgen

Microstructure generation
https://3mah.github.io
GNU General Public License v3.0
67 stars 8 forks source link

Add TPMS offset grading features #53

Closed kmarchais closed 5 months ago

kmarchais commented 6 months ago

This PR adds the grading of a TPMS based on the implicit distance to the surface of a mesh.

image

It is a draft PR for now, as the goal is to discuss the way to implement this feature.

In my opinion, having a class OffsetGrading allows the creation of additional classes that inherit from it for as many grading types as necessary. The first one implemented is NormedDistance. It allows the definition of an offset on the surface (boundary_offset) and an offset to the furthest point inside the mesh (furthest_offset). The offset of the TPMS then varies linearly within the mesh between these two offsets, following the normed distance to the surface of the mesh. A parameter boundary_weight is also available to adjust the weight on the boundary, such as weighted_distance = normed_distance**boundary_weight.

image