We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Saito OBJ loader: how to determine where lines are
Page Index Toggle Pages: 1
Saito OBJ loader: how to determine where lines are (Read 765 times)
Saito OBJ loader: how to determine where lines are
Feb 28th, 2009, 10:35am
 
Hey Processing-community,

another question from my side:
I am using the saito object loader to import 3D surfaces in my application. I know how to 'read' points from the file, since it is a function within the object loader. But how can I determine where the lines are from the object file?

Thanks in advance!
Re: Saito OBJ loader: how to determine where lines
Reply #1 - Feb 28th, 2009, 12:08pm
 
Are you referring to how triangles are written in the .obj file or how they are stored in the the objloader?


Re: Saito OBJ loader: how to determine where lines
Reply #2 - Feb 28th, 2009, 4:59pm
 
I refer to the following: in my appication I work with 2 classes: Node and Line.
the Node consists of 3 coordinates, which I can read out of the .obj file, using .vx, .vy and .vz (as is explained on the site of the saito object loader).
Though now I also somehow need to create Lines between those Nodes, and exactly the same as they are in the .obj file. Though there lines are represented by the normal-vectors of the lines. Am I right in that?
If so: how can I transform them into the Line-elements that I am using?
Re: Saito OBJ loader: how to determine where lines
Reply #3 - Mar 1st, 2009, 1:52am
 
hmm, so what your after is to get the triangulation of the mesh? so that you know that vertex a, b and c make a triangle, and then c,b,d make another triangle. So the line class knows that ab, bc, ca, cd, bd are lines?

If that's the case then the getting that through the obj loader could be a little tricky. The ojb loader stores a list of vert positions and vert normals and then there are a collection of modelsegments that store model elements. These elements are the triangles of the mesh. They are basicly indexes to the lists of vert positions and normals. So for what you're after you might be going about it the hard way.

HOWEVER, there are some undocumented functions that you could use (I think). try this

int segmentCount = model.getSegmentCount();

//use a number between 0 and segmentCount
int elementCount = model.getIndexCountInSegment(segment);

int[] vertIndexes = model.getVertIndexArrayInSegment(segment, element);

ok now vertIndexes *should* be an array of indexes to the original verts that you already have. And they should when taken in pairs give you the connection information between verts.

This is untested, and the above functions are part of the overhaul to the objloader that I'm in the middle of. Pretty sure that those functions are available in the latest version up on google code.

This week, work permitting I'm trying to get some time to update the loading code and a few extra bits, let me know if this works or not, I might be able to help out later in the week.


Re: Saito OBJ loader: how to determine where lines
Reply #4 - Mar 2nd, 2009, 10:34am
 
It seems those functions are not working in objectloader014 yet... and that is the latest version I can find on google code...
Re: Saito OBJ loader: how to determine where lines
Reply #5 - Mar 2nd, 2009, 10:46am
 
There is a beta of 015 here
http://code.google.com/p/saitoobjloader/source/browse/#svn/trunk/OBJ_Loader/library_014_beta
Re: Saito OBJ loader: how to determine where lines
Reply #6 - Mar 2nd, 2009, 11:50am
 
When I replace the objloader.jar file of version 014 with the beta014 that you gave me, I still am not able to use these functions. So I either replaced the wrong file, or the functions are not included yet, or there is another problem...
Re: Saito OBJ loader: how to determine where lines
Reply #7 - Mar 2nd, 2009, 2:36pm
 
apologies, chances are I've stuffed it up. I'll try to get a build up tomorrow.
Page Index Toggle Pages: 1