clear all;close all;clc;
Cell Properties
%user design inputs
>> cs=4;
>> cd_w=8;cd_h=8;
>> t=0.25;%thickness
>> f=20;%fineness
>> hs=cs/2;%half cell size
>> w=cs*cd_w;
>> hw=w/2;
>> h=cs*cd_h;
>> ht=t/2;
>> m=pi/hs;%periodicity multiplier
%design space range
>> x1=-hw;xu=hw;
>> y1=-hw;yu=hw;
>> z1=-hw;zu=hw;
%design space range to grid
>> x=[x1:cs/f:xu];
>> y=[y1:cs/f:yu];
>> z=[z1:cs/f:zu];
%design space grid
>> [X,Y,Z]=meshgrid(x,y,z);
TPMS Surface Selection
Select the desired lattice design from the TPMS options below by uncommenting the 3 corresponding lines below the TPMS design name.
The top line is the trigonometric representation(三角表示) of the TPMS cell. the second line is the function evaluation throughout the design space(整个设计空间的函数评估), the final line is the name that the .stl file will be saved as in the parent directory📁.
1️⃣Primitive Surface Function
>> PMS=@(x,y,z)cos(m*