[fluxus] pdata storage question

Dave Griffiths dave at pawfal.org
Thu Feb 16 03:16:02 PST 2006


> I'm wondering what exactly pdata stores.
> I want to deform an object, and i want to write an stl file based on this.
> basically I need a list of triangles and normals each triangle.
> so is pdata stored like:
> pt1
> pt2
> pt3
> pt4
>
> where the points define triangle pt1 pt2 pt3 and triangle pt2 pt3 pt4?
>  Am i completely off here?
> What about the normals? it doesn't really make sense for me that there
> are normals for each vertex, to find the actual normal for the
> triangle do you just add the normals at each vertex and then
> normalise?

everything is stored per-vertex. with normals this means that you can have
smooth or hard edges depending if the normals on coincident faces match or
not.

so for a simple case, a triangle list, the pdata is sequenced as follows

0 : face 0 vert 0
1 : face 0 vert 1
2 : face 0 vert 2
3 : face 1 vert 0
4 : face 1 vert 1
5 : face 1 vert 2

this lookup is the same for verts, normals, colours and texture coordinates.
if you're interested, the implicit topology means the primitive is
optimised to be very quick to render, but costs memory as points are
duplicated. this might also cost processing for calculations, but the fix
for this is to use triangle strips, rather than indexing the data (I'll
implement a stripification algorithm one day)

the topologies for the various primitive types:

cube: QUADS
plane: QUADS
sphere TRIANGLES
cylinder TRIANGLES

and for polygons built with (build-poly) the types can be any of the
following:

0=TRISTRIP 1=QUADS 2=TRILIST 3=TRIFAN 4=POLYGON

nurbs are simpler, as the topology is just a patch grid for both primitives.

cheers,

dave




More information about the Fluxus mailing list