%% FEATool Multiphysics Version 1.12.4, Build 20.07.188, Model M-Script file.
%% Created on 17-Jul-2020 14:20:32 with MATLAB 9.8.0.1359463 (R2020a) Update 1 PCWIN64.


%% Starting new model.
function test_non_intersecting()
fea.sdim = { 'x', 'y', 'z' };
fea.geom = struct;
fea = addphys( fea, @conductivemediadc, { 'V' } );
f = figure();

%% Geometry operations.
gobj = gobj_block( [0], [1], [0], [1], [0], [1], 'B1' );
fea = geom_add_gobj( fea, gobj );
gobj_tag = {'B1'};
[fea.geom, gobj_tag] = copy_geometry_object( gobj_tag, fea.geom );
[fea,gobj_tag] = geom_apply_transformation( fea, gobj_tag, [-2  0  0 ], [ 1  1  1 ], 0, [ 1  0  0 ], [0.5  0.5  0.5] );
update_plot ("B1 and B2 non overlapping");

%fea.geom = geom_apply_formula( fea.geom, 'B1+TF1' );
fea.geom = geom_apply_formula( fea.geom, 'B1-TF1' );
fea.geom = geom_apply_formula( fea.geom, 'TF1-B1' );
%fea.geom = geom_apply_formula( fea.geom, 'B1&TF1' );
update_plot ("After B1 +/-/& TF1");

fea = geom_apply_transformation( fea, 'B1', [ 0  0  0 ], [.5 .5 .5 ], 0, [ 1  0  0 ], [0.5  0.5  0.5] );
fea = geom_apply_transformation( fea, 'TF2', [-1.75 .25  .25], [ 1  1  1 ], 0, [ 1  0  0 ], [0.25  0.25  0.25] );
update_plot ("B1 and B2 completely overlapping");

fea.geom = geom_apply_formula( fea.geom, 'TF1-TF3' );
%fea.geom = geom_apply_formula( fea.geom, 'TF1+TF3' );
%fea.geom = geom_apply_formula( fea.geom, 'TF1&TF3' );
update_plot ("After TF1 +/-/& TF3");


    function update_plot (plot_title)   
        clf (f);
        title (plot_title);
        plotgeom (fea.geom,'parent', f);
        view(3);
        pause;
    end
end
    