Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

3D plotting of a partial sphere

180 views
Skip to first unread message

Eyal Fleminger

unread,
Apr 25, 2010, 12:57:05 PM4/25/10
to
I am trying to plot a 3D volume defined as part of a sphere. The volume is defined by six numbers in spherical coordinates (r, el & az): minimum/maximum range, minimum/maximum elevation (from -90 to 90), minimum/maximum azimuth (between 0 and 360). In general, the volume will have the shape of a wedge buth with one concave (at r=minimum range) and one convex (at r=maximum range) face. Particular cases will look different - for example, if minimum range=0, minimum azimuth=0, maximum azimuth=360, minimum elevation=0 and maximum elevation=90 the volume will have the shape of a hemisphere with a radius equal to the maximum range.

I need to plot this volume as a surface or patch. While I know how to plot a sphere or hemisphere (using sphere or ellipsoid), I can't figure out how to define the shape for other cases. I could use convhulln if not for the concave face at r=minimum range.
Can anyone offer any suggestions?

Thanks

Roger Stafford

unread,
Apr 25, 2010, 1:34:04 PM4/25/10
to
"Eyal Fleminger" <efle...@gmail.com> wrote in message <hr1s91$qtv$1...@fred.mathworks.com>...
-----------
Just make spherical coordinate meshes of each of the surfaces involved and combine them into one big mesh. Then convert it from spherical to cartesian coordinates. Piece of cake!

Roger Stafford

Eyal Fleminger

unread,
Apr 26, 2010, 2:54:05 AM4/26/10
to
> -----------
> Just make spherical coordinate meshes of each of the surfaces involved and combine them into one big mesh. Then convert it from spherical to cartesian coordinates. Piece of cake!
>
> Roger Stafford

How would I generate the meshes? Could you maybe give a simple example?

Thanks

Roger Stafford

unread,
Apr 26, 2010, 5:53:04 PM4/26/10
to
"Eyal Fleminger" <efle...@gmail.com> wrote in message <hr3dad$17g$1...@fred.mathworks.com>...
---------
I had something along these lines in mind. If you adjust the 'view' function, you can see this "wedge" from other directions.

r = 5;
[theta,phi] = meshgrid(linspace(0,.4*pi,32),linspace(-pi/2,pi/2,32));
x1 = r.*cos(theta).*cos(phi);
y1 = r.*sin(theta).*cos(phi);
z1 = r.*sin(phi);
theta = 0;
[r,phi] = meshgrid(linspace(0,5,32),linspace(-pi/2,pi/2,32));
x2 = r.*cos(theta).*cos(phi);
y2 = r.*sin(theta).*cos(phi);
z2 = r.*sin(phi);
theta = .4*pi;
[r,phi] = meshgrid(linspace(0,5,32),linspace(-pi/2,pi/2,32));
x3 = r.*cos(theta).*cos(phi);
y3 = r.*sin(theta).*cos(phi);
z3 = r.*sin(phi);
x = [x1;x2;x3];
y = [y1;y2;y3];
z = [z1;z2;z3];
surf(x,y,z)
axis square

Roger Stafford

0 new messages