Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: 2d project of a 3d point cloud
Date: Tue, 20 May 2008 06:22:02 +0000 (UTC)
Organization: Bosch Rexroth AG
Lines: 51
Message-ID: <g0tqma$9mj$1@fred.mathworks.com>
References: <g0kbks$ros$1@fred.mathworks.com> <g0kpom$ib5$1@fred.mathworks.com> <g0s18q$mtb$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1211264522 9939 172.30.248.37 (20 May 2008 06:22:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 20 May 2008 06:22:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 223445
Xref: news.mathworks.com comp.soft-sys.matlab:469396


Hi John,

> > Assuming that you have some data in an nx3
> > array like this...
> > 
> > xyz = randn(100,3); % just some random data
> > 
> > Use view to get the current viewing angles.
> > 
> > [az,el] = view;
> > 
> > Construct the normal vector to the viewing
> > plane from these angles.
> > 
> > az = az*pi/180;
> > el = el*pi/180;
> > normalvec=[1 0 0]*[cos(az) sin(az) 0;-sin(az) cos(az) 
0;0
> 0 1];
> > normalvec=normalvec*[cos(el) 0 sin(el);0 1 0;-sin(el) 0
> cos(el)];


I really like your way of solving this problem. I see that 
you use the null-function quite some times to takle 
different problems and even after looking at the 
documentation and on different web pages the concept of 
null is not quite clear to me. Why does this line work?

> > 
> > Project into the viewing plane.
> > 
> > uv = xyz*null(normalvec);

The rest of your algo is clear to me, but null...

> > 
> > Compute the convex hull in the viewing
> > plane.
> > 
> > hull = convexhull(uv(:,1),uv(:,2));
> > 
> > And compute the area of the resulting
> > polygon using polyarea.
> > 
> > A = polyarea(uv(hull,1),uv(hull,2));

Thank you very much for your valuable help on this 
newsgroup.

Gwen