Skip to content

write_ma

write_ma(path, V, R, E=None, F=None)

Write a medial mesh to a .ma file.

See read_ma for a description of the format.

Parameters:

Name Type Description Default
path str

Output path (overwritten if it exists).

required
V (n,3) numpy double array

Medial sphere centers.

required
R (n,) numpy double array

Medial sphere radii.

required
E (e,2) numpy int array, optional (default None)

Medial edges.

None
F (f,3) numpy int array, optional (default None)

Medial faces.

None

Raises:

Type Description
ValueError

If the inputs are inconsistent or the file cannot be written.

Notes

C++: bool libmat::write_ma(path, V, R, E, F) in <libmat/write_ma.h>.

Examples:

import libmat
V, F = libmat.read_surface_mesh("data/mesh_69058.obj")
C, R, _ = libmat.shrink_spheres(V, F, num_spheres=500)
libmat.write_ma("spheres.ma", C, R)   # spheres only, no edges/faces

C++

#include <libmat/write_ma.h>

// Write a medial mesh to a .ma file (see read_ma for the format).
//
// Inputs:
//   path  output path (overwritten)
//   V  #V by 3 medial sphere centers
//   R  #V medial sphere radii
//   E  #E by 2 medial edges
//   F  #F by 3 medial faces
// Returns true on success.
bool write_ma(const std::string& path, const Eigen::MatrixXd& V,
              const Eigen::VectorXd& R, const Eigen::MatrixXi& E,
              const Eigen::MatrixXi& F);