I'm having trouble doing this without errors. My code generally works when it's not trying to render vertical or horizontal planes. As of now, there's a workaround that stops it from trying to graph the problem planes, but I'd like to have it work in every case.
normal = cross (v1,v2); origin = [0 0 0]; starts = zeros(3,3); ends = [v1;v2;origin];
realdot = @(u,v)(u * transpose(v));
syms x y z P = [x,y,z]; planefunction = realdot(normal, P); zplane = solve(planefunction, z);
if(isempty(zplane) == 0) ezmesh(zplane, [xmin, xmax, ymin, ymax]), hold on else plane = char(planefunction); fprintf('The two vectors create the vertical/horizontal plane %s = 0\n', plane); end
How can I create an expression that the ezmesh function can understand for those flat planes (i.e. x=0)?
I tried using the fill3 function to create a triangular surface with vertices at the origin and each of the vector endpoints, but I could never get that to work either.
The way you are calliing EZMESH inteprets the input as z = f(x,y). So you can't express things like the x=0 plane.
But what you are trying to do can easily be accomplished by using EZMESH to plot a parametric surface, like the following. This code plots the plane spanned by any v1 and v2. See the help for EZMESH.
v1 = randn(3,1); v2 = randn(3,1);
figure; hold on;
plot3([0 v1(1)],[0 v1(2)],[0 v1(3)],'k','linewidth',6); plot3([0 v2(1)],[0 v2(2)],[0 v2(3)],'k','linewidth',6); ezmesh(@(s,t)v1(1)*s+v2(1)*t,@(s,t)v1(2)*s+v2(2)*t,@(s,t)v1(3)*s+v2(3)*t)