Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% C++ Shape Function Plot.
- % Pre-Processing
- clear all;close all;clc
- % Create Plot
- x=-20:.1:20;
- y=x;
- z=x;
- [X,Y,Z]=meshgrid(x,y,z);
- % our_function = @(x,y,z) (sqrt(x.^2+y.^2+z.^2)<10); % Example
- our_function = @(x,y,z) (z*15*15*15+2*(x.^2+2.25*y.^2)*(x.^2+2.25*y.^2)<0); % Shape Function 1 Simplified
- our_function = @(x,y,z) (z*15*15*15+2*(x.^2+2.25*y.^2)*(x.^2+2.25*y.^2)<0)&&(x.^2>0.01*15*15)&&(z>-2.3*15)
- % Shape Function 1
- % Extended
- B=our_function(X,Y,Z);
- [X,Y,Z]=meshgrid(x,y,z);
- p = patch(isosurface(X,Y,Z,B,0));
- set(p,'FaceColor','red','EdgeColor','none');
- daspect([1,1,1])
- view([0,45]);
- camlight;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement