Sign in to follow this  
Tipotas688

Ply Files

Recommended Posts

Here's an example ply for reference:

ply
format ascii 1.0
element vertex 11
property float x
property float y
property float z
element face 11
property list uchar int vertex_indices
end_header
0 1 0
0 3 0
2 0 0
2 2 0
2 4 0
3 2 10
4 1.8 0
4 2.2 0
6 0 0
6 2 0
6 4 0
3 0 2 3
3 0 3 1
3 1 3 4
3 2 6 3
3 3 6 5
3 3 5 7
3 3 7 4
3 5 6 7
3 6 8 9
3 6 9 7
3 7 9 10

Share this post


Link to post
Share on other sites
Looks like the header says you first how many vertices you have,
and which components they have.

In your case 11 vertices with x,y and z coordinates.

And it tells you that you have 11 faces (quads in your case).

So your vertices are:

0 1 0
0 3 0
2 0 0
2 2 0
2 4 0
3 2 10
4 1.8 0
4 2.2 0
6 0 0
6 2 0
6 4 0

And your vertex indices for the faces are:

3 0 2 3
3 0 3 1
3 1 3 4
3 2 6 3
3 3 6 5
3 3 5 7
3 3 7 4
3 5 6 7
3 6 8 9
3 6 9 7
3 7 9 10

Hth,
Marc

Share this post


Link to post
Share on other sites
I m ok with that but how will I use the faces in order to create the actual shape?

I suppose the faces tell you where to place the vertices? I ve writen some code for it but it doesnt seem to work properly...

Share this post


Link to post
Share on other sites
If I'm correct with my assumption that the indices are for polygons, then
you should build your polygon according to the indices. That means
that you use the first four indices to get the vertices to draw.

In your supplied file you would draw a quad with the vertices 3,0,2,3 (First Face)
And then with the next four indices
(vertices 3, 0, 3, 1) - if you are using OpenGL you can use glBegin(GL_QUADS).

But it is not even close to being performant - for performance you have to
build an index buffer and a vertex buffer and draw with VertexBuffer Objects or
the equivalents in DirectX.

Marc

Share this post


Link to post
Share on other sites
Its triangles as the first one shows how many corners there are, or so I guess.

I found out what was my problem, in the end I had understood what ply files have in them but I had put the wrong number in the tables so they looked up the previous face.

Thanks though :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this