ply

package
v1.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: BSD-3-Clause Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ply reads PLY files, the ASCII kind and the binary kind in both byte orders (SPEC §28.5), into a model.Model.

A file has a vertex element with the position (x, y and z) and optionally the normal (nx, ny, nz), the color (red, green, blue and alpha) and the texture coordinates (s and t, u and v, texture_u and texture_v), and a face element whose list property vertex_indices (or vertex_index) names the corners of each polygon, which is cut into triangles. A file with no faces is a point cloud: its mesh is of points, which viewport3d draws with its point material. Positions that the file stores as double are kept in float64 (model.Mesh.Positions64) when some of them are not exact in float32. Other elements and properties are skipped, with one line in the log for each kind.

Index

Constants

View Source
const TagPLYInvalid = "PLYInvalid"

TagPLYInvalid is the tag of the error of a file that is not a valid PLY file: a bad header, a body that is cut short, a number that is not one or that is not finite, an index that names no vertex, a file with no vertex or no triangle. The metadata has "reason" (a short fixed phrase), and "line" (the header, and the body of an ASCII file) or "offset" (the byte, in a binary body).

Flutter: no counterpart

Variables

This section is empty.

Functions

func Decode

func Decode(ctx context.Context, r io.Reader, opts ...Options) (*model.Model, error)

Decode reads a PLY file from r. It checks ctx while it reads and parses.

It fails with model.TagModelReadFailed when the reader fails or ctx is done, and with TagPLYInvalid for a file that is not PLY.

Flutter: no counterpart

func Load

func Load(ctx context.Context, fsys fs.FS, name string, opts ...Options) (*model.Model, error)

Load reads the PLY file name of fsys. The model's name is the file's base name without its extension, unless the options give one.

Flutter: no counterpart

Types

type Options

type Options struct {
	// Name is the name of the model, its node and its mesh. Load sets the base name of the file when it is empty.
	Name string
	// Logger gets the notes of the loader (the elements and properties that it skipped, the faces that it dropped); slog.Default()
	// when nil.
	Logger *slog.Logger
}

Options are the options of Decode and Load.

Flutter: no counterpart

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL