⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ply_files.txt

📁 C语言滤波程序
💻 TXT
字号:
The PLY Polygon File Format---------------------------Introduction------------This document presents the PLY polygon file format, a format for storinggraphical objects that are described as a collection of polygons.  Our goal isto provide a format that is simple and easy to implement but that is generalenough to be useful for a wide range of models.  The file format has twosub-formats: an ASCII representation for easily getting started, and a binaryversion for compact storage and for rapid saving and loading.  We hope thatthis format will promote the exchange of graphical object between programs andalso between groups of people.Overview--------Anyone who has worked in the field of computer graphics for even a short time knows about the bewildering array of storage formats for graphical objects.  It seems as though every programmer creates a new file format for nearly every new programming project.  The way out of this morass of formats is to create a single file format that is both flexible enough to anticipate future needs and that is simple enough so as not to drive away potential users.  Once such a format is defined, a suite of utilities (both procedures and entire programs) can be written that are centered around this format.  Each new utility that is added to the suite can leverage off the power of the others.The PLY format describes an object as a collection of vertices, faces andother elements, along with properties such as color and normal direction thatcan be attached to these elements.  A PLY file contains the description ofexactly one object.  Sources of such objects include: hand-digitized objects,polygon objects from modeling programs, range data, triangles from marchingcubes (isosurfaces from volume data), terrain data, radiosity models.Properties that might be stored with the object include: color, surfacenormals, texture coordinates, transparency, range data confidence, anddifferent properties for the front and back of a polygon.The PLY format is NOT intended to be a general scene description language, a shading language or a catch-all modeling format.  This means that it includes no transformation matrices, object instantiation, modeling hierarchies, or object sub-parts.A typical PLY object definition is simply a list of (x,y,z) triples forvertices and a list of faces that are described by indices into the list ofvertices.  Most PLY files include this core information.  Vertices and facesare two examples of "elements", and the bulk of a PLY file is its list ofelements.  Each element in a given file has a fixed number of "properties" thatare specified for each element.  The typical information in a PLY file containsjust two elements, the (x,y,z) triples for vertices and the vertex indices foreach face.  Applications can create new properties that are attached toelements of an object.  For example, the properties red, green and blue arecommonly associated with vertex elements.  New properties are added in such away that old programs do not break when these new properties are encountered.Properties that are not understood by a program can either be carried alonguninterpreted or can be discarded.  In addition, one can create a new elementtype and define the properties associated with this element.  Examples of newelements are edges, cells (lists of pointers to faces) and materials (ambient,diffuse and specular colors and coefficients).  New elements can also becarried along or discarded by programs that do not understand them.File Structure--------------This is the structure of a typical PLY file:  Header  Vertex List  Face List  (lists of other elements)The header is a series of carraige-return terminated lines of text thatdescribe the remainder of the file.  The header includes a description of eachelement type, including the element's name (e.g. "edge"), how many suchelements are in the object, and a list of the various properties associatedwith the element.  The header also tells whether the file is binary or ASCII.Following the header is one list of elements for each element type, presentedin the order described in the header.Below is the complete ASCII description for a cube.  The header of a binaryversion of the same object would differ only in substituting the word"binary_little_endian" or "binary_big_endian" for the word "ascii".  Thecomments in brackets are NOT part of the file, they are annotations to thisexample.  Comments in files are ordinary keyword-identified lines that beginwith the word "comment".plyformat ascii 1.0           { ascii/binary, format version number }comment made by anonymous  { comments keyword specified, like all lines }comment this file is a cubeelement vertex 8           { define "vertex" element, 8 of them in file }property float32 x         { vertex contains float "x" coordinate }property float32 y         { y coordinate is also a vertex property }property float32 z         { z coordinate, too }element face 6             { there are 6 "face" elements in the file }property list uint8 int32 vertex_index { "vertex_indices" is a list of ints }end_header                 { delimits the end of the header }0 0 0                      { start of vertex list }0 0 10 1 10 1 01 0 01 0 11 1 11 1 04 0 1 2 3                  { start of face list }4 7 6 5 44 0 4 5 14 1 5 6 24 2 6 7 34 3 7 4 0This example demonstrates the basic components of the header.  Each part ofthe header is a carraige-return terminated ASCII string that begins with akeyword.  Even the start and end of the header ("ply<cr>" and"end_header<cr>") are in this form.  The characters "ply<cr>" must be thefirst four characters of the file, since they serve as the file誷 magicnumber.  Following the start of the header is the keyword "format" and aspecification of either ASCII or binary format, followed by a versionnumber.  Next is the description of each of the elements in the polygonfile, and within each element description is the specification of theproperties.  Then generic element description has this form:element <element-name> <number-in-file>property <data-type> <property-name-1>property <data-type> <property-name-2>property <data-type> <property-name-3>...The properties listed after an "element" line define both the data type of the property and also the order in which the property appears for each element.  There are three kinds of data types a property may have: scalar, string andlist.  Here is a list of the scalar data types a property may have:name        type        number of bytes---------------------------------------int8       character                 1uint8      unsigned character        1int16      short integer             2uint16     unsigned short integer    2int32      integer                   4uint32     unsigned integer          4float32    single-precision float    4float64    double-precision float    8These byte counts are important and must not vary across implementations inorder for these files to be portable.  There is a special form of propertydefinitions that uses the list data type:  property list <numerical-type> <numerical-type> <property-name>An example of this is from the cube file above:  property list uint8 int32 vertex_indexThis means that the property "vertex_index"  contains first an unsigned chartelling how many indices the property contains, followed by a list containingthat many integers.  Each integer in this variable-length list is an index toa vertex.Another Example---------------Here is another cube definition:plyformat ascii 1.0comment author: anonymouscomment object: another cubeelement vertex 8property float32 xproperty float32 yproperty float32 zproperty red uint8                     { start of vertex color }property green uint8property blue uint8element face 7property list uint8 int32 vertex_index { number of vertices for each face }element edge 5                         { five edges in object }property int32 vertex1                 { index to first vertex of edge }property int32 vertex2                 { index to second vertex }property uint8 red                     { start of edge color }property uint8 greenproperty uint8 blueend_header0 0 0 255 0 0                          { start of vertex list }0 0 1 255 0 00 1 1 255 0 00 1 0 255 0 01 0 0 0 0 2551 0 1 0 0 2551 1 1 0 0 2551 1 0 0 0 2553 0 1 2                           { start of face list, begin with a triangle }3 0 2 3                           { another triangle }4 7 6 5 4                         { now some quadrilaterals }4 0 4 5 14 1 5 6 24 2 6 7 34 3 7 4 00 1 255 255 255                   { start of edge list, begin with white edge }1 2 255 255 2552 3 255 255 2553 0 255 255 2552 0 0 0 0                         { end with a single black line }This file specifies a red, green and blue value for each vertex.  Toillustrate the variable-length nature of vertex_index, the first two faces ofthe object are triangles instead of a single square.  This means that thenumber of faces in the object is 7.  This object also contains a list ofedges.  Each edge contains two pointers to the vertices that delinate theedge.  Each edge also has a color.  The five edges defined above werespecified so as to highlight the two triangles in the file.  The first fouredges are white, and they surround the two triangles.  The final edge isblack, and it is the edge that separates the triangles.User-Defined Elements---------------------The examples above showed the use of three elements: vertices, faces and edges.  The PLY format allows users to define their own elements as well.  The format for defining a new element is exactly the same as for vertices, faces and edges.  Here is the section of a header that defines a material property:element material 6property ambient_red uint8               { ambient color }property ambient_green uint8property ambient_blue uint8property ambient_coeff float32property diffuse_red uint8               { diffuse color }property diffuse_green uint8property diffuse_blue uint8property diffuse_coeff float32property specular_red uint8              { specular color }property specular_green uint8property specular_blue uint8property specular_coeff float32property specular_power float32          { Phong power }These lines would appear in the header directly after the specification ofvertices, faces and edges.  If we want each vertex to have a materialspecification, we might add this line to the end of the properties for avertex:  property material_index int32This integer is now an index into the list of materials contained in the file.It may be tempting for the author of a new application to invent several newelements to be stored in PLY files.  This practice should be kept to aminimum.  Much better is to try adapting common elements (vertices, faces,edges, materials) to new uses, so that other programs that understand theseelements might be useful in manipulating these adapted elements.  Take, forexample, an application that describes molecules as collections of spheres andcylinders.  It would be tempting define sphere and cylinder elements for thePLY files containing the molecules.  If, however, we use the vertex and edgeelements for this purpose (adding the radius property to each), we can makeuse of programs that manipulate and display vertices and edges.  Clearly oneshould not create special elements for triangles and quadrilaterals, butinstead use the face element.(c) 1998 Greg Turk

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -