Hello friends, I hope you are spending a few moments full of joy and fun, in my case I am having fun breaking my head with the problem that I will try to explain. I have the following function, which it does is cut a prism by the y-axis.
dtr[{{x_, y_, z_}, {x1_, y1_, z1_}}] :=
Module[{yes, xs, zeta, inf, sup, val}, yes = (y1 - y)/2;
val = RandomChoice[{1, 3/2, 2, 5/2}]; xs = x1 - x; zeta = z1 - z;
inf = {{x, y, z} - {0, 0, val}, {x + xs, y + yes, zeta} - {0, 0,
val}}; sup = {{x, y + yes, z} + {0, 0, val}, {x + xs, y + 2 yes,
zeta} + {0, 0, val}}; {inf, sup}]
Here is an example of what this function performs
dtr[{{0, 0, 0}, {32, 32, 8}}]
Graphics3D[Map[Cuboid, %]]
The problem arises, when you want to continue applying the function to the previous result on several occasions, I tried to use NestList, but without success, as shown in the following image.
This is something like what you expect to get after you have applied the function four times.
{{{0, 0, -6}, {32, 2, 23/2}}, {{0, 2, -3}, {32, 4, 29/2}}, {{0,
4, -3}, {32, 6, 23/2}}, {{0, 6, 0}, {32, 8, 29/2}}, {{0,
8, -(7/2)}, {32, 10, 19/2}}, {{0, 10, -(1/2)}, {32, 12, 25/
2}}, {{0, 12, -(3/2)}, {32, 14, 19/2}}, {{0, 14, 3/2}, {32, 16, 25/
2}}, {{0, 16, -4}, {32, 18, 11/2}}, {{0, 18, -2}, {32, 20, 15/
2}}, {{0, 20, 1}, {32, 22, 11/2}}, {{0, 22, 3}, {32, 24, 15/
2}}, {{0, 28, 9/2}, {32, 30, 1/2}}, {{0, 30, 13/2}, {32, 32, 5/
2}}, {{0, 24, 2}, {32, 26, 0}}, {{0, 26, 5}, {32, 28, 3}}}
Could someone help me solve my problem?, Maybe the use of NestList is not correct in this case, any help is welcome. Thanks in advance
Attachments: