PDA

View Full Version : reading vertex's in specific order


swardson
07-18-2005, 04:57 PM
ok all,

I have an interesting problem to solve, and I a bit at a loss of how to do it.

Basicly I am attempting to write a mel script that examines poly objects in the scene and writes a model file in a special format to be read in by another piece of software. This file format is a lot like .obj but different.

I have most of it working, however when I define the list of faces in this model file I need to create it based on an index of the vertex list created:

//this is the vertex list
-0.5 -0.5 0.5
0.5 -0.5 0.5
-0.5 0.5 0.5
0.5 0.5 0.5
-0.5 0.5 -0.5
0.5 0.5 -0.5
-0.5 -0.5 -0.5
0.5 -0.5 -0.5

//this is the face list
1 2 3
2 3 4
3 4 5
4 5 6
5 6 7
6 7 8
1 7 8
1 2 8
2 4 8
4 6 8
1 5 7
1 3 5

where each number in the face list corrisponds to the # in the vertex list above. No biggy right. well I need to gather the vertices corrisponding to each face to do that. so I used polyListConponentConversion to do that, but I need the vertices to be read in counter clockwise. the reason for this is that the program importing this file bases its surface normal by reading the vetices counter clockwise, and points the number up based on that.

I am basically wondering how I could read the vertex's associated with the selected face in counter clockwise?


let me know if more information about this would help,

Thanks a bunch, in advance guys

-Brad

DangerAhead
07-19-2005, 05:57 PM
Brad,

Geordie here. Have you tried using PolyTrans? I bought a copy for our company and it is amazing. It'll probably have a translator for your two apps.

Maya to ?

? to Maya

What two apps are you using?

Otherwise, it seems you can simply reverse the normals on your poly objects BEFORE you run your script and it should export the face declarations in the correct order.

swardson
07-19-2005, 06:09 PM
Thanks DangerAhead,

We actually already own Deep exploration that handles most of our conversions, however this format is for a piece of software developed at my company and therefore has a unique layout but built off of the .fac file standard.

I actually solved the problem last night, it turns out that if you use polyInfo -fv on a selected face, it will return the vertices in the order that follows the right hand rule. Basically it returns the vertices in the order that when read they move counter-clockwise about its facet and thus the normal faces out.

Thanks for your help again,

Brad

DangerAhead
07-19-2005, 07:29 PM
Brad,

Seems we're doing similar things.

I've been getting raw data from a scientist (Carl Haber) at LBL.
http://www.lbl.gov/Science-Articles/Archive/Phys-quarks-to-blues.html

He's scanning an old-fashioned wax cylinder from the 1800s and extracting the audio off of the 3D scan. Pretty cool, but the data is basically 1500 points across -- rotate 1 degree -- 1500 points across -- rotate 1 degree and so forth. and if the cylinder is warped the data is all over the place.

If you work with raw data TO Maya, let me know. I have some tools for this I made in Flash!! Parsing scripts that generate MEL that you can cut and paste into Maya.

CGTalk Moderation
07-19-2005, 07:29 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.