Skip to content

ValueError: Invalid number of dimensions for argument 'v_positions'. Expected 2 but got 1. #34

@sugizo

Description

@sugizo

env
google colab

steps

pip install -U pymartini point-cloud-utils
!wget -c https://raw.githubusercontent.com/kylebarron/pymartini/master/test/data/fuji.png

code

import imageio.v2 as imageio
from pymartini import decode_ele, Martini, rescale_positions
import point_cloud_utils as pcu

path = './fuji.png'
fuji = imageio.imread(path)
terrain = decode_ele(fuji, 'mapbox')
martini = Martini(fuji.shape[0] + 1)
tile = martini.create_tile(terrain)
vertices, triangles = tile.get_mesh(10)
pcu.save_triangle_mesh(f'{file_name}_pcu.stl', v = vertices, f = triangles)

result

ValueError                                Traceback (most recent call last)
[<ipython-input-10-420b66e278b6>](https://localhost:8080/#) in <cell line: 11>()
      9 tile = martini.create_tile(terrain)
     10 vertices, triangles = tile.get_mesh(10)
---> 11 pcu.save_triangle_mesh(f'{file_name}_pcu.stl', v = vertices, f = triangles)

1 frames
[/usr/local/lib/python3.10/dist-packages/point_cloud_utils/_mesh_io.py](https://localhost:8080/#) in save(self, filename, dtype)
    283                 raise ValueError("Invalid values for wedge colors, must be between 0 and 1 (inclusive)")
    284 
--> 285         save_mesh_internal(filename,
    286                            np.ascontiguousarray(self.vertex_data.positions.astype(dtype)),
    287                            np.ascontiguousarray(self.vertex_data.normals.astype(dtype)),

ValueError: Invalid number of dimensions for argument 'v_positions'. Expected 2 but got 1.

n.b.
the same steps work fine with pydelatin

best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions