function mp=Build_RotateSampleTest() % Bulid mp obj (contains models and all arguments) %% init pace=1; Pst=[0 0 0]-[1 2 1]-pace*0.5001; Ped=[10 20 10]+2; Ped=FCM_dV.round_Ped(Pst,Ped,pace); maxdeep=4; order=1; viewxy=[120 30]; Shape.accessThreshold(pace/maxdeep/2/2/2);% Oa=[0 0 0]; Ra=[0 0 0]; rvec=(Ped-Pst)/pace num_cells=rvec(1)*rvec(2)*rvec(3); fprintf("num_cells: %.0f\n",num_cells);% show num of cells %% add SS lib & python path additon_path=pwd; if count(py.sys.path,additon_path) == 0 insert(py.sys.path,int32(0),additon_path); end %% assemble c0 cyObjs=[]; pos=[ 1 1 0; 0 1 0; 0 0 0; 1 0 0; 1 1 0; 0 0 1; 1 0 1; 1 1 1; ]; angle=[ 0 0 0; 0 0 0; -pi/2 0 0; -pi/2 0 0; 0 -pi/2 0; -pi/2 0 0; -pi/2 0 0; 0 -pi/2 0; ]; for i=0:10:0 for j=0:10:10 for k=0:10:0 for idx=1:size(angle,1) cy=CSG("Cylinder",[i j k]+pos(idx,:)*10,angle(idx,:),1,1*10); cyObjs=[cyObjs cy]; end end end end firstFlg=1; cys=[]; for cy=cyObjs if firstFlg==1 firstFlg=0; cys=cy; else cys=cys+cy; end end %% tmp output % c.set_display_args([Pst(1) Pst(2) Pst(3)],Ped,pace/5,'viewxy',viewxy); % c.csg2stl('/home/cflin/Documents/MATLAB/MatlabCode/TopCSG/NNew_Data/RotateSample/CSG_plates'); % % cys.set_display_args([Pst(1) Pst(2) Pst(3)],Ped,pace/5,'viewxy',viewxy); % cys.csg2stl('/home/cflin/Documents/MATLAB/MatlabCode/TopCSG/NNew_Data/RotateSample/CSG_cylinders'); % % limitedCube=CSG("Cube","corner",[0 0 0+0.1],Ra,[12 12 6]+[0 0 -0.1]); % limitedCube.set_display_args([Pst(1) Pst(2) Pst(3)],Ped,pace/5,'viewxy',viewxy); % limitedCube.csg2stl('/home/cflin/Documents/MATLAB/MatlabCode/TopCSG/NNew_Data/RotateSample/CSG_limitedCube'); % % limitedCys=limitedCube*cys; % limitedCys.set_display_args([Pst(1) Pst(2) Pst(3)],Ped,pace/5,'viewxy',viewxy); % limitedCys.csg2stl('/home/cflin/Documents/MATLAB/MatlabCode/TopCSG/NNew_Data/RotateSample/CSG_limitedCylinders'); % left plate leftPlate=CSG("Cube","corner",[0 0 0]-[1 2 1],Ra,[12 2 12]); c=leftPlate+cys; %---------------------------assemble c % show model clf; c.set_display_args([Pst(1) Pst(2) Pst(3)],Ped,pace/5,'viewxy',viewxy); c.display_csg(); % c.csg2stl('/home/cflin/Documents/MATLAB/MatlabCode/TopCSG/NNew_Data/RotateSample/initModel'); V0=1; %% % time and calculate Volume tic fcmv=FCM_V(Pst,Ped,pace,maxdeep,order,@c.calSF,@(X) ones(size(X,1),1));% |||1 dV V0=fcmv.calIntegral_V(); fprintf('V0: %f ,Time: %f\n',V0,toc); %% build Dirichlet/Neumann boundary eepsD=1e-4; eepsN=3; Dirich_csg=CSG("Cube","corner",[0 0 0]-[1 2 1],Ra,[12 0 12]); Dirich_csg.saveAs('Dir'); Dirich_csg.judge_func=@(X) abs(X(:,2)--2)< eepsD; %------------------------------------------Neu Neuman_csg=CSG("Cube","corner",[5 20 0]-[1 1 1],Ra,[2 2 2]); Neuman_csg.judge_func=@(X) abs(X(:,2)-20)