MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / writePointsPLY

Function writePointsPLY

src/parsers/colmapPlyWriter.ts:7–27  ·  view source on GitHub ↗
(points3D: Map<Point3DId, Point3D>)

Source from the content-addressed store, hash-verified

5 * PLY is a common format supported by MeshLab, CloudCompare, and other 3D viewers.
6 */
7export function writePointsPLY(points3D: Map<Point3DId, Point3D>): string {
8 const header = [
9 'ply',
10 'format ascii 1.0',
11 `element vertex ${points3D.size}`,
12 'property float x',
13 'property float y',
14 'property float z',
15 'property uchar red',
16 'property uchar green',
17 'property uchar blue',
18 'end_header',
19 ].join('\n') + '\n';
20
21 const data: string[] = [];
22 for (const pt of points3D.values()) {
23 data.push(`${pt.xyz[0]} ${pt.xyz[1]} ${pt.xyz[2]} ${pt.rgb[0]} ${pt.rgb[1]} ${pt.rgb[2]}`);
24 }
25
26 return header + data.join('\n') + '\n';
27}

Callers 3

exportPointsPLYFunction · 0.90
exportPointsPLYFileFunction · 0.85

Calls 1

valuesMethod · 0.65

Tested by

no test coverage detected