<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/155029</link>
    <title>MATLAB Central Newsreader - tristripping of vertices matrix</title>
    <description>Feed for thread: tristripping of vertices matrix</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, 23 Aug 2007 13:15:11 -0400</pubDate>
      <title>tristripping of vertices matrix</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/155029#388991</link>
      <author>Felix Morsdorf</author>
      <description>Hello all,&lt;br&gt;
&lt;br&gt;
I am trying to write a function that outputs the content of a matlab opengl &lt;br&gt;
rendered axis to an OpenSceneGraph (.osg) file for faster 3d visualization.&lt;br&gt;
&lt;br&gt;
I have so far succeeded for simple objects like point, lines and patches.&lt;br&gt;
&lt;br&gt;
For objects of type 'surf' I am now facing the problem of converting the &lt;br&gt;
matlab generated vertices and vertex normals matrices into triangle strips.&lt;br&gt;
&lt;br&gt;
Matlab vertices (three times for x,y,z)               Tristrip(s):&lt;br&gt;
1 2 3                                                                1 4 2 5 3 6 &lt;br&gt;
4 5 6                                                                4 7 5 8 6 9&lt;br&gt;
7 8 9&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
I have now implemeted a very clumsy (using loops and slow!) way of doing it, &lt;br&gt;
which generates some triangles that are not in the original data.  Does &lt;br&gt;
anybody know a way of doing it using e.g. clever indexing  ?&lt;br&gt;
&lt;br&gt;
cheers,&lt;br&gt;
&lt;br&gt;
Felix</description>
    </item>
    <item>
      <pubDate>Thu, 23 Aug 2007 13:23:37 -0400</pubDate>
      <title>Re: tristripping of vertices matrix</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/155029#388992</link>
      <author>Titus</author>
      <description>&lt;br&gt;
&quot;Felix Morsdorf&quot; &amp;lt;felix.morsdorf@geo.uzh.ch&amp;gt; schrieb im Newsbeitrag &lt;br&gt;
news:fak18v$j47$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; Hello all,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am trying to write a function that outputs the content of a matlab &lt;br&gt;
&amp;gt; opengl&lt;br&gt;
&amp;gt; rendered axis to an OpenSceneGraph (.osg) file for faster 3d &lt;br&gt;
&amp;gt; visualization.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I have so far succeeded for simple objects like point, lines and patches.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; For objects of type 'surf' I am now facing the problem of converting the&lt;br&gt;
&amp;gt; matlab generated vertices and vertex normals matrices into triangle &lt;br&gt;
&amp;gt; strips.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Matlab vertices (three times for x,y,z)               Tristrip(s):&lt;br&gt;
&amp;gt; 1 2 3                                                                1 4 2 &lt;br&gt;
&amp;gt; 5 3 6&lt;br&gt;
&amp;gt; 4 5 6                                                                4 7 5 &lt;br&gt;
&amp;gt; 8 6 9&lt;br&gt;
&amp;gt; 7 8 9&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I have now implemeted a very clumsy (using loops and slow!) way of doing &lt;br&gt;
&amp;gt; it,&lt;br&gt;
&amp;gt; which generates some triangles that are not in the original data.  Does&lt;br&gt;
&amp;gt; anybody know a way of doing it using e.g. clever indexing  ?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; cheers,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Felix&lt;br&gt;
&lt;br&gt;
Hi Felix,&lt;br&gt;
at least for this example the following works:&lt;br&gt;
A = reshape(1:9,3,3)'&lt;br&gt;
ATri = reshape(A([1 2 2 3],:), 2, 6)&lt;br&gt;
&lt;br&gt;
Hope, this helps,&lt;br&gt;
Titus</description>
    </item>
    <item>
      <pubDate>Thu, 23 Aug 2007 14:44:58 -0400</pubDate>
      <title>Re: tristripping of vertices matrix</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/155029#389013</link>
      <author>Felix Morsdorf</author>
      <description>Many thanks Titus for your help!&lt;br&gt;
&lt;br&gt;
It works very well, the generalised form will look like this:&lt;br&gt;
&lt;br&gt;
A = reshape(1:20,4,5)';&lt;br&gt;
[m,n] = size(A);&lt;br&gt;
&amp;nbsp;jj = [1:m-1,2:m];&lt;br&gt;
&amp;nbsp;ATri = reshape(A(jj,:),m-1,n*2);&lt;br&gt;
&lt;br&gt;
these lines replace about four time the code with loops :-)&lt;br&gt;
&lt;br&gt;
cheers,&lt;br&gt;
&lt;br&gt;
Felix&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&quot;Titus&quot; &amp;lt;titus.edelhofer@mathworks.de&amp;gt; wrote in message &amp;lt;fak1oq$pig&lt;br&gt;
$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;Felix Morsdorf&quot; &amp;lt;felix.morsdorf@geo.uzh.ch&amp;gt; schrieb im Newsbeitrag &lt;br&gt;
&amp;gt; news:fak18v$j47$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; &amp;gt; Hello all,&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I am trying to write a function that outputs the content of a matlab &lt;br&gt;
&amp;gt; &amp;gt; opengl&lt;br&gt;
&amp;gt; &amp;gt; rendered axis to an OpenSceneGraph (.osg) file for faster 3d &lt;br&gt;
&amp;gt; &amp;gt; visualization.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I have so far succeeded for simple objects like point, lines and patches.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; For objects of type 'surf' I am now facing the problem of converting the&lt;br&gt;
&amp;gt; &amp;gt; matlab generated vertices and vertex normals matrices into triangle &lt;br&gt;
&amp;gt; &amp;gt; strips.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Matlab vertices (three times for x,y,z)               Tristrip(s):&lt;br&gt;
&amp;gt; &amp;gt; 1 2 3                                                                1 4 2 &lt;br&gt;
&amp;gt; &amp;gt; 5 3 6&lt;br&gt;
&amp;gt; &amp;gt; 4 5 6                                                                4 7 5 &lt;br&gt;
&amp;gt; &amp;gt; 8 6 9&lt;br&gt;
&amp;gt; &amp;gt; 7 8 9&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I have now implemeted a very clumsy (using loops and slow!) way of &lt;br&gt;
doing &lt;br&gt;
&amp;gt; &amp;gt; it,&lt;br&gt;
&amp;gt; &amp;gt; which generates some triangles that are not in the original data.  Does&lt;br&gt;
&amp;gt; &amp;gt; anybody know a way of doing it using e.g. clever indexing  ?&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; cheers,&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Felix&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hi Felix,&lt;br&gt;
&amp;gt; at least for this example the following works:&lt;br&gt;
&amp;gt; A = reshape(1:9,3,3)'&lt;br&gt;
&amp;gt; ATri = reshape(A([1 2 2 3],:), 2, 6)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hope, this helps,&lt;br&gt;
&amp;gt; Titus&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; </description>
    </item>
  </channel>
</rss>

