Describe the bug, what's wrong, and what you expected.
Since the infill feature update, a change in the _compute_tpms_field method made impossible to make tpms surfaces follow cylindrical or spherical coordinates.
def _compute_tpms_field(self: Tpms) -> None:
"""Compute the TPMS scalar field on the grid."""
linspaces: list[npt.NDArray[np.float64]] = [
np.linspace(
-0.5 * cell_size_axis * repeat_cell_axis,
0.5 * cell_size_axis * repeat_cell_axis,
self.resolution * repeat_cell_axis,
)
for repeat_cell_axis, cell_size_axis in zip(
self.repeat_cell,
self.cell_size,
)
]
x, y, z = np.meshgrid(*linspaces)
self.grid = self._create_grid(x, y, z)
k_x, k_y, k_z = 2.0 * np.pi / self.cell_size
x, y, z = self.grid.points.T
tpms_field = self.surface_function(
k_x * (x + self.phase_shift[0]),
k_y * (y + self.phase_shift[1]),
k_z * (z + self.phase_shift[2]),
)
self.grid["surface"] = tpms_field.ravel(order="F")
For the infill feature, the line x, y, z = self.grid.points.T has been introduced since x, y, z do not have the same dimensions as the grid because the grid for infill have a different shape after clipping with the surface of the object filled with TPMS.
But when we want to generate a cylindrical or spherical TPMS, now the x, y, z are the points of the grid in the new frame while they are required to be in the original cartesian frame.
I think the solution to this problem is to save these original coordinates in the grid as a field.
Describe the bug, what's wrong, and what you expected.
Since the infill feature update, a change in the
_compute_tpms_field
method made impossible to make tpms surfaces follow cylindrical or spherical coordinates.For the infill feature, the line
x, y, z = self.grid.points.T
has been introduced since x, y, z do not have the same dimensions as the grid because the grid for infill have a different shape after clipping with the surface of the object filled with TPMS.But when we want to generate a cylindrical or spherical TPMS, now the x, y, z are the points of the grid in the new frame while they are required to be in the original cartesian frame.
I think the solution to this problem is to save these original coordinates in the grid as a field.