scimesh 0.3.2
Headless CPU-only 3D software renderer for scientific mesh visualization
Loading...
Searching...
No Matches
scimesh::ply_io Namespace Reference

Functions for reading PLY files. More...

Functions

Mesh read_ply (const std::string &path)
 Load a mesh from a Stanford PLY file.
 

Detailed Description

Functions for reading PLY files.

Function Documentation

◆ read_ply()

Mesh scimesh::ply_io::read_ply ( const std::string &  path)

Load a mesh from a Stanford PLY file.

Reads vertex positions, face indices, and optionally per-vertex colors and normals. Both ASCII and binary (little-endian) PLY files are supported.

Parameters
pathFilesystem path to the .ply file.
Returns
A Mesh populated with the file's geometry.
Exceptions
std::runtime_errorif the file cannot be opened or parsed.
Example
Mesh scan = scimesh::ply_io::read_ply("bunny.ply");
std::cout << "Loaded " << scan.vertices.size() << " vertices\n";
Mesh read_ply(const std::string &path)
Load a mesh from a Stanford PLY file.
Definition ply_io.cpp:12
A 3D triangle mesh using an indexed face set representation.
Definition mesh.h:76
std::vector< Vec3 > vertices
3D vertex positions.
Definition mesh.h:86
Color support
If the PLY file contains per-vertex RGB colors, they are automatically loaded into Mesh::colors. Use mesh.has_colors() to check.
See also
read_obj(), read_stl(), Mesh::has_colors()

Definition at line 12 of file ply_io.cpp.