#ifndef PLY_H #define PLY_H /* * PLY.h * PointProcessing * * Created by Renato Pajarola on Wed Nov 05 2003. * Copyright (c) 2003 UC Irvine. All rights reserved. * */ #include #include "vector3.h" typedef float Vector3f[3]; typedef unsigned char Color3u[3]; typedef float Texture2f[2]; typedef int Index3i[3]; typedef int Index2i[2]; class PLYObject { public: PLYObject(FILE *in); ~PLYObject(); // Initialization routines bool checkHeader(FILE *in); void readVertices(FILE *in); void readFaces(FILE *in); void findConnectivity(); void resize(); // Get/Set and checking methods bool areAdjacent(int f1, int f2); bool alreadyConnected(int f1, int f2); Geometry::Vector3Df faceCenter(int f); // Runtime routines void invertNormals(); void appendEdge(int face, int edge); void draw(); // protected: int nproperties; // number of vertex properties char order[11]; // order of x,y,z, nx,ny,nz, red,green,blue, tu,tv vertex properties bool hasnormal, hascolor, hastexture, hasedges; int nv, nf, ne; // number of vertices, faces, edges Vector3f min, max; Vector3f *vertices; // array of point coordinates Vector3f *normals; // array of point normals Color3u *colors; // array of point colors Texture2f *texcoords; // array of texture coords Index3i *faces; // array of face indices Index2i *edges; // array of edges connecting faces (each entry has 2 faces) Index3i *nodes; // array of edges that touch each face (e. e. has 3 edges) Vector3f *fnormals; // array of face normals }; #endif