help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plot ellipsoidal normal


From: Andy Buckle
Subject: Re: plot ellipsoidal normal
Date: Mon, 27 Jun 2011 14:39:33 +0100



2011/6/27 Clara Brück <address@hidden>
Hello,

I've got an ellipsoid as a 3D-Graph:

#Ellipsoid
xc=0
yc=0
zc=0
xr=yr= 7000
zr=5000
n = 25
[A,B,C] = ellipsoid(xc,yc,zc,xr,yr,zr,n);
mesh(A,B,C)

Then I have a Point on the surface.:

p2= [A(17,20) B(17,20) C(17,20)];

How can I plot a line, that goes orthogonal to the surface in this point, to the middle (z-axis)?

Hope someone's got an idea.

Greetings
Clara


_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave

I expect there is a much more elegant way than this...
(I changed to surf, because I could not see inside with mesh.)
I would be interested if there was a nicer way of changing from 3-vectors to lists of coordinates for plotting.)

xc=0
yc=0
zc=0
xr=yr= 7000
zr=5000
n = 25
[A,B,C] = ellipsoid(xc,yc,zc,xr,yr,zr,n);
surf(A,B,C)

i1=17; i2=20;
p1= [A(i1,i2) B(i1,i2) C(i1,i2)];
p2= [A(i1+1,i2) B(i1+1,i2) C(i1+1,i2)];
p3= [A(i1,i2+1) B(i1,i2+1) C(i1,i2+1)];
hold on
plot3(p1(1),p1(2),p1(3), 'rx')
plot3(p2(1),p2(2),p2(3), 'gx')
plot3(p3(1),p3(2),p3(3), 'bx')
t1=p1-p2;% direction of a tangent near p1
t2=p1-p3;
n=cross(t1,t2); % a normal vector
n=-1000*n/norm(n);% resize, so you can see it
ne=p1-n;% position of end of vector
x=[p1; ne](:,1);
y=[p1; ne](:,2);
z=[p1; ne](:,3);
plot3(x,y,z)


--
/* andy buckle */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]