> So, my question is the following:
> How can I draw an ellipsoid surface having ellipsoid's axes directions and
> axes lengths?
what you can do in scilab is to produce a set of facelets which
approximate the ellipsoid surface, and to plot them with plot3d or the
like, facelet mode. As an example, attached is the function sphere()
from the toolbox ENRICO. It should be rather easy to extend it to an
ellipsoid, either by means of a coordinate transformation of all of the
points of the generated facelets, or directly on the parametric
representation of the vertices as functions of (u,v). I'm just lazy
about working out for you the geometry for the general case, all the
matrix manipulations involved, etc.
hth, Enrico
function [xx,yy,zz]=sphere(x0,r,n)
// expanded from SCI/surface/surfaces.sci
[lhs,rhs]=argn(0);
if rhs<3 then n=16; end
if rhs<2 then r=1; end
if rhs<1 then x0=[0,0,0]; end
if size(x0)==[3,1] then x0=x0'; end
if size(x0,2)<>3 then
disp('wrong size of x0'); return
end
ns=size(x0,1)
if length(r)<>ns then r=r(1)*ones(ns,1); end
vn=2*n
// prototype sphere
u = linspace(-%pi/2,%pi/2,n);
v = linspace(0,2*%pi,vn);
x= cos(u)'*cos(v);
y= cos(u)'*sin(v);
z= sin(u)'*ones(v);
in=1:(n-1); inp=2:n; in2=1:(vn-1)
xxx=[matrix(x(in,in2+1),1,(n-1)*(vn-1));
matrix(x(in,in2),1,(n-1)*(vn-1));
matrix(x(inp,in2),1,(n-1)*(vn-1));
matrix(x(inp,in2+1),1,(n-1)*(vn-1))]
yyy=[matrix(y(in,in2+1),1,(n-1)*(vn-1));
matrix(y(in,in2),1,(n-1)*(vn-1));
matrix(y(inp,in2),1,(n-1)*(vn-1));
matrix(y(inp,in2+1),1,(n-1)*(vn-1))]
zzz=[matrix(z(in,in2+1),1,(n-1)*(vn-1));
matrix(z(in,in2),1,(n-1)*(vn-1));
matrix(z(inp,in2),1,(n-1)*(vn-1));
matrix(z(inp,in2+1),1,(n-1)*(vn-1))]
//multiplication of spheres
nf=size(xxx,2);
xx=zeros(4,nf*ns); yy=xx; zz=xx
for i=1:ns
xx(:,((i-1)*nf+1):i*nf)=xxx*r(i)+x0(i,1)
yy(:,((i-1)*nf+1):i*nf)=yyy*r(i)+x0(i,2)
zz(:,((i-1)*nf+1):i*nf)=zzz*r(i)+x0(i,3)
end
endfunction