Path: news.mathworks.com!not-for-mail
From: "Felix Morsdorf" <felix.morsdorf@geo.uzh.ch>
Newsgroups: comp.soft-sys.matlab
Subject: tristripping of vertices matrix
Date: Thu, 23 Aug 2007 13:15:11 +0000 (UTC)
Organization: Universit&#228;t Z&#252;rich
Lines: 23
Message-ID: <fak18v$j47$1@fred.mathworks.com>
Reply-To: "Felix Morsdorf" <felix.morsdorf@geo.uzh.ch>
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 1187874911 19591 172.30.248.37 (23 Aug 2007 13:15:11 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 23 Aug 2007 13:15:11 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 498125
Xref: news.mathworks.com comp.soft-sys.matlab:425193



Hello all,

I am trying to write a function that outputs the content of a matlab opengl 
rendered axis to an OpenSceneGraph (.osg) file for faster 3d visualization.

I have so far succeeded for simple objects like point, lines and patches.

For objects of type 'surf' I am now facing the problem of converting the 
matlab generated vertices and vertex normals matrices into triangle strips.

Matlab vertices (three times for x,y,z)               Tristrip(s):
1 2 3                                                                1 4 2 5 3 6 
4 5 6                                                                4 7 5 8 6 9
7 8 9


I have now implemeted a very clumsy (using loops and slow!) way of doing it, 
which generates some triangles that are not in the original data.  Does 
anybody know a way of doing it using e.g. clever indexing  ?

cheers,

Felix