<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457</link>
    <title>MATLAB Central Newsreader - Cubed Sphere</title>
    <description>Feed for thread: Cubed Sphere</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 13 Aug 2009 19:13:02 -0400</pubDate>
      <title>Cubed Sphere</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457#672996</link>
      <author>Matt </author>
      <description>Hi All --&lt;br&gt;
&lt;br&gt;
Does anyone have an algorithm to generate a cubed sphere? Ideally, I would pass the function a scalar (e.g., # of tiles per face) and would receive the Cartesian coordinates of every vertex on the cubed sphere. Thanks a bunch.&lt;br&gt;
&lt;br&gt;
Matt</description>
    </item>
    <item>
      <pubDate>Thu, 13 Aug 2009 20:08:01 -0400</pubDate>
      <title>Re: Cubed Sphere</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457#673022</link>
      <author>Roger Stafford</author>
      <description>&quot;Matt&quot; &amp;lt;matt_evans.nospam@ncsu.edu&amp;gt; wrote in message &amp;lt;h61oju$d55$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi All --&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Does anyone have an algorithm to generate a cubed sphere? Ideally, I would pass the function a scalar (e.g., # of tiles per face) and would receive the Cartesian coordinates of every vertex on the cubed sphere. Thanks a bunch.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Matt&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Little is to be gained by presenting a task that has been the subject of many papers.  It is not an appropriate problem for this kind of newsgroup.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Thu, 13 Aug 2009 20:15:17 -0400</pubDate>
      <title>Re: Cubed Sphere</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457#673024</link>
      <author>Matt </author>
      <description>&amp;gt;   Little is to be gained by presenting a task that has been the subject of many papers.  It is not an appropriate problem for this kind of newsgroup.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Roger Stafford&lt;br&gt;
&lt;br&gt;
Roger -- thanks for your reply. I have seen many papers that discuss the USE of the cubed sphere, but none that address the generation of said sphere. Perhaps this problem is trivial for topologists or computer scientists, but I am neither. Could you be so kind as to point me in the direction of some of these references.&lt;br&gt;
&lt;br&gt;
Matt</description>
    </item>
    <item>
      <pubDate>Thu, 13 Aug 2009 20:48:02 -0400</pubDate>
      <title>Re: Cubed Sphere</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457#673036</link>
      <author>Roger Stafford</author>
      <description>&quot;Matt&quot; &amp;lt;matt_evans.nospam@ncsu.edu&amp;gt; wrote in message &amp;lt;h61s8l$ph0$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Roger -- thanks for your reply. I have seen many papers that discuss the USE of the cubed sphere, but none that address the generation of said sphere. Perhaps this problem is trivial for topologists or computer scientists, but I am neither. Could you be so kind as to point me in the direction of some of these references.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Matt&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;Perhaps I didn't make myself clear, Matt.  What I meant was that this problem undoubtedly involves a very extensive programming effort even if good algorithms have been devised.  In other words, it is the opposite of being too trivial; it is not trivial enough.  It is for this reason that I deem it inappropriate here in this newsgroup.  We prefer answering questions that can be explained in just a few lines of code, and I seriously doubt that that would be true for generating cubed spheres, particularly of the generality of an arbitrary number of tiles per face that you are looking for.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;You might check on the Matlab File Exchange to see if anyone has taken the trouble to deal with it.  I do see a www site that seems to be concerned with this area and  involves matlab routines:&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&lt;a href=&quot;http://mitgcm.org/r2_web_testing/latest/online_documents/node227.html&quot;&gt;http://mitgcm.org/r2_web_testing/latest/online_documents/node227.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Thu, 13 Aug 2009 21:45:20 -0400</pubDate>
      <title>Re: Cubed Sphere</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457#673052</link>
      <author>Bruno Luong</author>
      <description>&quot;Matt&quot; &amp;lt;matt_evans.nospam@ncsu.edu&amp;gt; wrote in message &amp;lt;h61oju$d55$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi All --&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Does anyone have an algorithm to generate a cubed sphere? Ideally, I would pass the function a scalar (e.g., # of tiles per face) and would receive the Cartesian coordinates of every vertex on the cubed sphere. Thanks a bunch.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Matt&lt;br&gt;
&lt;br&gt;
Try this:&lt;br&gt;
&lt;br&gt;
n=10; % making (9 x 9 tiles per faces) for one of the six faces&lt;br&gt;
&lt;br&gt;
x = 1;&lt;br&gt;
y = linspace(-1,1,n);&lt;br&gt;
z = y;&lt;br&gt;
[X Y Z] = ndgrid(x,y,z);&lt;br&gt;
&lt;br&gt;
S = sqrt(1./(X.^2+Y.^2+Z.^2));&lt;br&gt;
X = X.*S;&lt;br&gt;
Y = Y.*S;&lt;br&gt;
Z = Z.*S;&lt;br&gt;
&lt;br&gt;
C1 = [X(:) Y(:) Z(:)].';&lt;br&gt;
M = makehgtform('zrotate',pi/2);&lt;br&gt;
C2 = M(1:3,1:3)*C1;&lt;br&gt;
M = makehgtform('zrotate',pi);&lt;br&gt;
C3 = M(1:3,1:3)*C1;&lt;br&gt;
M = makehgtform('zrotate',3*pi/2);&lt;br&gt;
C4 = M(1:3,1:3)*C1;&lt;br&gt;
M = makehgtform('yrotate',pi/2);&lt;br&gt;
C5 = M(1:3,1:3)*C1;&lt;br&gt;
M = makehgtform('yrotate',-pi/2);&lt;br&gt;
C6 = M(1:3,1:3)*C1;&lt;br&gt;
&lt;br&gt;
C = [C1 C2 C3 C4 C5 C6].';&lt;br&gt;
tol = 1e-3/(n-1);&lt;br&gt;
Cround = round(C/tol);&lt;br&gt;
[Cround I] = unique(Cround,'rows');&lt;br&gt;
Vertex = C(I,:);&lt;br&gt;
&lt;br&gt;
figure(1); clf&lt;br&gt;
plot3(Vertex(:,1),Vertex(:,2),Vertex(:,3),'.');&lt;br&gt;
axis equal&lt;br&gt;
&lt;br&gt;
% Bruno</description>
    </item>
    <item>
      <pubDate>Thu, 13 Aug 2009 22:22:02 -0400</pubDate>
      <title>Re: Cubed Sphere</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457#673063</link>
      <author>Matt </author>
      <description>&quot;Bruno Luong&quot; &amp;lt;b.luong@fogale.findmycountry&amp;gt; wrote in message &amp;lt;h621hg$sfs$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Try this:&lt;br&gt;
&amp;gt; &lt;br&gt;
Bruno --&lt;br&gt;
&lt;br&gt;
Thanks a bunch for the reply.&lt;br&gt;
&lt;br&gt;
I think that works -- but it is difficult for me to be certain until I figure out a better way to visualize it. The point cloud &quot;looks right&quot;, but I want to see the actual grid to confirm this.&lt;br&gt;
&lt;br&gt;
Thanks again.&lt;br&gt;
&lt;br&gt;
Matt</description>
    </item>
    <item>
      <pubDate>Thu, 13 Aug 2009 22:56:03 -0400</pubDate>
      <title>Re: Cubed Sphere</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457#673073</link>
      <author>Bruno Luong</author>
      <description>% Now you can chek it:&lt;br&gt;
&lt;br&gt;
n=17;&lt;br&gt;
&lt;br&gt;
x = 1;&lt;br&gt;
y = linspace(-1,1,n);&lt;br&gt;
z = y;&lt;br&gt;
[X Y Z] = ndgrid(x,y,z);&lt;br&gt;
&lt;br&gt;
S = sqrt(1./(X.^2+Y.^2+Z.^2));&lt;br&gt;
X = X.*S;&lt;br&gt;
Y = Y.*S;&lt;br&gt;
Z = Z.*S;&lt;br&gt;
&lt;br&gt;
C1 = [X(:) Y(:) Z(:)].';&lt;br&gt;
M = makehgtform('zrotate',pi/2);&lt;br&gt;
C2 = M(1:3,1:3)*C1;&lt;br&gt;
M = makehgtform('zrotate',pi);&lt;br&gt;
C3 = M(1:3,1:3)*C1;&lt;br&gt;
M = makehgtform('zrotate',3*pi/2);&lt;br&gt;
C4 = M(1:3,1:3)*C1;&lt;br&gt;
M = makehgtform('yrotate',pi/2);&lt;br&gt;
C5 = M(1:3,1:3)*C1;&lt;br&gt;
M = makehgtform('yrotate',-pi/2);&lt;br&gt;
C6 = M(1:3,1:3)*C1;&lt;br&gt;
&lt;br&gt;
[i j] = ndgrid(1:n-1,1:n-1);&lt;br&gt;
i = i(:); j=j(:);&lt;br&gt;
P = [sub2ind([n n], i, j) ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sub2ind([n n], i+1, j) ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sub2ind([n n], i+1, j+1) ...&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sub2ind([n n], i, j+1)];&lt;br&gt;
offset =  n^2*(0:5)';&lt;br&gt;
P = bsxfun(@plus, offset, reshape(P,[1 size(P)]));&lt;br&gt;
P = reshape(P, [], 4);&lt;br&gt;
&lt;br&gt;
C = [C1 C2 C3 C4 C5 C6].';&lt;br&gt;
tol = 1e-3/(n-1);&lt;br&gt;
Cround = round(C/tol);&lt;br&gt;
[Cround I J] = unique(Cround,'rows');&lt;br&gt;
Vertices = C(I,:);&lt;br&gt;
P = J(P);&lt;br&gt;
&lt;br&gt;
figure(1); clf;&lt;br&gt;
patch('Vertices',Vertices,'Faces',P,'FaceColor','g');&lt;br&gt;
axis equal&lt;br&gt;
&lt;br&gt;
% Bruno</description>
    </item>
    <item>
      <pubDate>Fri, 14 Aug 2009 02:47:02 -0400</pubDate>
      <title>Re: Cubed Sphere</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457#673111</link>
      <author>Matt </author>
      <description>&quot;Bruno Luong&quot; &amp;lt;b.luong@fogale.findmycountry&amp;gt; wrote in message &amp;lt;h625m3$7tk$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; % Now you can chek it:&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
Bruno -- quite nice, indeed. This is perfect. Thanks very much for the help.&lt;br&gt;
&lt;br&gt;
Matt</description>
    </item>
    <item>
      <pubDate>Fri, 14 Aug 2009 12:09:20 -0400</pubDate>
      <title>Re: Cubed Sphere</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457#673170</link>
      <author>Bruno Luong</author>
      <description>FYI I have updated the code with another grid parametrization (equiangular). It seems more popularly used. It has been submitted to FEX.&lt;br&gt;
&lt;br&gt;
While googling, I see a lot of papers around conformal mapping, which has the advantages as well as the inconveniences. I couldn't implement because of lack of a detailed description (selection of the pole, etc...). I can't have access to relevant paper.&lt;br&gt;
&lt;br&gt;
Bruno</description>
    </item>
    <item>
      <pubDate>Fri, 14 Aug 2009 14:50:20 -0400</pubDate>
      <title>Re: Cubed Sphere</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457#673235</link>
      <author>Matt </author>
      <description>&quot;Bruno Luong&quot; &amp;lt;b.luong@fogale.findmycountry&amp;gt; wrote in message &amp;lt;h63k5g$oo0$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; FYI I have updated the code with another grid parametrization (equiangular). It seems more popularly used. It has been submitted to FEX.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; While googling, I see a lot of papers around conformal mapping, which has the advantages as well as the inconveniences. I couldn't implement because of lack of a detailed description (selection of the pole, etc...). I can't have access to relevant paper.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Bruno&lt;br&gt;
&lt;br&gt;
Bruno -- thanks a ton. I'd like to try the updated code, but I do not see it yet on the File Exchange. How long does it typically take for files to become available? Thanks.&lt;br&gt;
&lt;br&gt;
Matt</description>
    </item>
    <item>
      <pubDate>Fri, 14 Aug 2009 15:11:07 -0400</pubDate>
      <title>Re: Cubed Sphere</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457#673242</link>
      <author>Bruno Luong</author>
      <description>Matt, normally it'll show up shortly. If in few hours nothing showed up I'll send you the code.&lt;br&gt;
&lt;br&gt;
Bruno</description>
    </item>
    <item>
      <pubDate>Fri, 14 Aug 2009 15:41:06 -0400</pubDate>
      <title>Re: Cubed Sphere</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/258457#673257</link>
      <author>Bruno Luong</author>
      <description>I'ts up! Enjoy.&lt;br&gt;
&lt;br&gt;
Bruno</description>
    </item>
  </channel>
</rss>

