3D to 2D projection

  • Follow


I am trying to map a hemisphere to a circle, i.e getting subplot
(1,2,2) from subplot(1,2,1) of the code below. Is there a set
transformation matrix that exist to do this mapping without needing to
specify view([0 90]) ?

My overall task is to fill each square or even trapezoid on the
'walls' of the hemisphere with an image and then project them to a 2D
circular image. I am not quite sure how to do that! Any advice on the
data structures and transformations to use will be greatly
appreciated.

----------------------
n = 18; % n is the number of points in the drawing of the sphere.
R = 1;  % radius

theta = 2*pi*(0:n)/n; %polar angle
phi = (pi/2)*(0:3:n)'/n; % azimuthal angle
r = R*cos(phi);

% Parametric Equation of a sphere X(r,theta,phi),Y(r,theta,phi),Z
(r,theta,phi):
xsphere = r*cos(theta);
ysphere = r*sin(theta);
zsphere = R*sin(phi)*ones(size(theta));

%Plots
subplot(1,2,1)
surf(xsphere,ysphere,zsphere);
axis equal

subplot(1,2,2)
surf(xsphere,ysphere,zsphere);
view([0 90]);
grid('off')
0
Reply viv3kg (13) 12/14/2009 11:24:46 AM

On 14 Des, 12:24, "Jean V.G" <viv...@gmail.com> wrote:
> I am trying to map a hemisphere to a circle, i.e getting subplot
> (1,2,2) from subplot(1,2,1) of the code below. Is there a set
> transformation matrix that exist to do this mapping without needing to
> specify view([0 90]) ?

The 'simplest' way that did not manipulate VIEW would
be to disregard the z coordinate, and use PATCH to
plot the individual faces in the (x,y) plane. This
*can* be done without using VIEW, but it is far simpler
for you to just set the z coordinate to 0 and use VIEW.

Rune
0
Reply Rune 12/14/2009 11:34:22 AM


1 Replies
722 Views

(page loaded in 0.378 seconds)

Similiar Articles:













7/23/2012 7:11:16 AM


Reply: