"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <icvafr$93i$1@fred.mathworks.com>...
> "Robert Phillips" <phillir1@my.erau.edu> wrote in message <icv3mb$rqg$1@fred.mathworks.com>...
> > Thank you so much for helping me out. Just one more question..
> >
> > I understand that three of the inputs for 'ellipsoid' are XR, YR, ZR, which would correspond to a, b, c semiaxes lengths. My question is, how do I choose exactly which a, b, c length corresponds to XR, YR, ZR?
> >
> > For example, I could use:
> > [x y z] = ellipsoid(0, 0, 0, a, b, c, n), or
> > [x y z] = ellipsoid(0, 0, 0, b, c, a, n).
> >
> > Initially I thought that it doesn't necessarily matter what the order is but I can't seem to back up that train of thought.
>          
> You originally stated that "the vectors a_S, b_S, & c_S, which describe the semimajor and semiminor axes a,b,c". I assume the word 'respectively' was implied there. When you write
>
> [X Y Z] = ellipsoid(0, 0, 0, a, b, c, n);
>
> this makes the X, Y, Z be the ellipsoidaligned coordinates along which the three a, b, c semiaxes extend, respectively. Therefore it is X that you multiply a_S by, Y by b_S, and Z by c_S in the expression I gave you to get x, y, and z in the final coordinate system.
>
> By the same reasoning, if you wrote
>
> [X Y Z] = ellipsoid(0, 0, 0, b, c, a, n)
>
> this would require that you multiply X by b_S, Y by c_S, and Z by a_S in that expression in order to live up to your statement above.
>
> Roger Stafford
Roger,
Thank you for all of your help; I've put a lot of it to good use. It turns out your assistance with determining whether a point lies outside of an arbitrarily oriented ellipsoid has helped as well. I'm having a bit of an issue with it...
Before you read, I'll let you know that my question is, have I properly used the ellipsoid expression, which you provided me, to assure that the only ellipsoids stored are those which remain inside of a shape described by a set of points?
Let me introduce to you why I have been seeking help. I have approximated the geometry of asteroids with the largest possible sphere which neither exits the surface nor intersects other defined spheres. I am now doing the same for ellipsoids.
I seem to have just about everything figured out. The code cycles through all possible maximumsized ellipsoids, stores the centroid and axis vectors a_E, b_E, c_E (from centroid E to a surface point s, not normalized) of ellipsoids which don't exit the surface or intersect other defined ellipsoids, and finally store the ONE ellipsoid's centroid and axis vectors which return the largest volume (max size).
So it goes: all possible ellipsoids, ellipsoids which don't exit, max volume ellipsoid
However, I think that the way I filter out ellipsoids which exit/intersect is not working properly:
% If little to no surface points satisfy the ellipsoid region, store ellipsoid.
if sum(any( (XR.^2/a^2 + YR.^2/b^2 + ZR.^2/c^2) >= 1) == 0) < 5
% Assign axis vectors a_E, b_E, & c_E to elpsds.
elpsds{e} = [max_dists(i,1:3);a_E(i,:);b_E(i,:);c_E(i,:)];
elpsds_vol(e) = (4/3)*pi*a*b*c;
e = e +1
end % End testing ellipsoids for exiting.
Where:
max_dists is the xyz coords of the proposed centroid E
a_E, b_E, c_E are axis vectors of lengths a, b, c whose tails lie at proposed E
XR,YR,ZR are described by
dot( surface points s(:,:)  centroid E , normalized axis vector), or
dot( astrd_surf(:,:)  max_dists(i,1:3) / norm(...), a_E(i,1:3) / norm(...) ), or,
dot( r_Es / r, a_E / a ).
But, I had to find a way to perform a dot product of a mby3 matrix and a 1by 3 matrix. This is what I used to describe that (for XR):
r_Es = bsxfun(@minus,astrd_surf,max_dists(i,1:3));
r = sqrt(sum(r_Es.*r_Es,2));
XR = cellfun(@sum,...
(mat2cell((r_Es(:,1:3).*(repmat(a_E(i,:)/a,...
size(r_Es(:,1:3),1),1))),...
ones(1,size(r_Es(:,1:3),1)),3)));
I apologize for this is lengthy, but I figured it may help to associate the proper context with my questions.
So, I reiterate my earlier question, now:
Have I properly used the ellipsoid expression, which you provided me, to assure that the only ellipsoids stored are those which remain inside of a shape described by a set of points?
Or, do you see any errors above?
Thank you,
Robby
