PLY文件格式
PLY(Polygon File Format)多边形文件格式(斯坦福三角格式),表示3D文件格式,用于存储描述为多边形集合的图形对象
PLY文件格式有
ASCII:用于轻松启动
二进制格式:用于紧凑存储和快速保存和加载
PLY文件的结构
Header
Vertex List
Face List
(lists of other elements)
eg:
ply format ascii 1.0 { ascii/binary, format version number } comment this file is a cube element vertex 8 { define "vertex" element, 8 of them in file } property float x { vertex contains float "x" coordinate } property float y { y coordinate is also a vertex property } property float z { z coordinate, too } element face 6 { there are 6 "face" elements in the file } property list uchar int 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 1 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 1 0 4 0 1 2 3 { start of face list } 4 7 6 5 4 4 0 4 5 1 4 1 5 6 2 4 2 6 7 3 4 3 7 4 0
说明:
注解 {……}
元素描述
element <元素名> <在文件里的个数> property <数据类型> <属性名-1> property <数据类型> <属性名-2> ……
属性的数据类型
#Name | #Type | #Number of Bytes char | character | 1 uchar | unsigned character | 1 short | short integer | 2 ushort | unsigned short integer | 2 int | Integer | 4 uint | unsigned Integer | 4 float | single-precision float | 4 double | double precision float | 8
http://paulbourke.net/dataformats/ply/