- Join over
**1.5M+ people** - Join over
**100K+ communities** - Free
**without limits** - Create
**your own community**

Hi there, I got a problem when I try to create a Trimesh object by

'tri_mesh = trimesh.Trimesh(vertices=self.vertices, faces=self.vertices, face_normals=self.normals) ',

'self.vertices.shape, self.faces.shape, self.normals.shape = (92846, 3) , (185743, 3), (185743, 3)'

But

'tri_mesh.vertices.shape, tri_mesh.faces.shape, tri_mesh.face_normals.shape = (92846, 3) (92846, 3) (92846, 3) '。

I couldn't understand what happend.

'tri_mesh = trimesh.Trimesh(vertices=self.vertices, faces=self.vertices, face_normals=self.normals) ',

'self.vertices.shape, self.faces.shape, self.normals.shape = (92846, 3) , (185743, 3), (185743, 3)'

But

'tri_mesh.vertices.shape, tri_mesh.faces.shape, tri_mesh.face_normals.shape = (92846, 3) (92846, 3) (92846, 3) '。

I couldn't understand what happend.

Hello all, I'm loading several meshes to the same scene and wanted to change the color of some. Is there any way to change the default color when or after calling

`load_mesh()`

? Using `mesh.visual.face_colors`

doesn't seem to produce a clear effect, because I kinda see some color being changed, but it's not all of the mesh...
facecolor is a vector of the same length as mesh.faces

Not fully developed thought, but you could get a COO matrix:

```
In [1]: import trimesh
In [2]: m = trimesh.creation.icosphere()
In [3]: m.face_adjacency
Out[3]:
array([[ 394, 992],
[ 538, 1189],
[ 416, 970],
...,
[ 86, 340],
[ 340, 348],
[ 337, 348]])
In [4]: g = trimesh.graph.edges_to_coo(m.face_adjacency, count=len(m.face
...: s))
In [5]: g
Out[5]:
<1280x1280 sparse matrix of type '<class 'numpy.bool_'>'
with 1920 stored elements in COOrdinate format>
In [6]: import numpy as np
In [7]: np.sum(g, axis=0)
Out[7]: matrix([[0, 0, 0, ..., 2, 2, 3]], dtype=int64)
In [8]: np.sum(g, axis=1)
Out[8]:
matrix([[3],
[3],
[3],
...,
[1],
[1],
[0]], dtype=int64)
```

generally the winding preference is counterclockwise

and wanted to know which one is upper left and lower right

```
In [1]: import trimesh
In [2]: m = trimesh.creation.box()
In [3]: m
Out[3]: <trimesh.base.Trimesh at 0x7effccdba710>
In [4]: m.vertices
Out[4]:
TrackedArray([[-0.5, -0.5, -0.5],
[-0.5, -0.5, 0.5],
[-0.5, 0.5, -0.5],
[-0.5, 0.5, 0.5],
[ 0.5, -0.5, -0.5],
[ 0.5, -0.5, 0.5],
[ 0.5, 0.5, -0.5],
[ 0.5, 0.5, 0.5]])
In [6]: import numpy as np
In [7]: at_extrema = np.isclose(m.vertices[:,2], m.vertices[:,2].max())
In [8]: at_extrema
Out[8]: TrackedArray([False, True, False, True, False, True, False, True])
In [10]: at_extrema[m.faces]
Out[10]:
TrackedArray([[ True, True, False],
[False, True, False],
[False, True, False],
[False, False, False],
[ True, True, True],
[ True, True, False],
[ True, True, True],
[ True, True, False],
[False, False, False],
[False, True, False],
[False, True, False],
[ True, True, False]])
In [11]: at_extrema[m.faces].all(axis=1)
Out[11]:
TrackedArray([False, False, False, False, True, False, True, False,
False, False, False, False])
In [12]: top = at_extrema[m.faces].all(axis=1)
In [13]: m.visual.face_colors[top] = [255,0,0,255]
In [14]: m.show()
```

or you could check the face normals of the mesh

but relying on order is probably kind of flaky

@mikedh hey Mike! Great work. I have a question that I feel better suited here rather than as a github issue: I wonder how

`obj.ray.intersects_location`

(the pyembree one) works under the hood; does it cache the tree in `obj`

, or does it recompute the tree every time `obj.ray.intersects_location`

gets called?
I guess should be the former, but just want to double check. In my case, I call

`obj.ray.intersects_location()`

multiple times on the same object `obj`

. Do I need to worry about the recomputation of the tree, or is it take care of under the hood?
Tried to find it under docs / examples but some of the links are broken.

```
In [1]: import trimesh
In [2]: m = [trimesh.primitives.Sphere() for i in range(10)]
In [3]: m
Out[3]:
[<trimesh.primitives.Sphere at 0x7fe317ff0ef0>,
<trimesh.primitives.Sphere at 0x7fe317782080>,
<trimesh.primitives.Sphere at 0x7fe3177822e8>,
<trimesh.primitives.Sphere at 0x7fe317782550>,
<trimesh.primitives.Sphere at 0x7fe3177827b8>,
<trimesh.primitives.Sphere at 0x7fe317782a20>,
<trimesh.primitives.Sphere at 0x7fe317782c88>,
<trimesh.primitives.Sphere at 0x7fe317782ef0>,
<trimesh.primitives.Sphere at 0x7fe317787198>,
<trimesh.primitives.Sphere at 0x7fe317787400>]
In [4]: trimesh.util.concatenate(m)
Out[4]: <trimesh.base.Trimesh at 0x7fe317742f28>
```

I'm trying to implement the LBO operator on python,

I'm trying to implement the LBO operator on python, https://en.m.wikipedia.org/wiki/Laplace%E2%80%93Beltrami_operator,

And I need to compute the laplacian of the mesh (mass and stiffness matrices),

I see that you use the laplacian as part of some of the modules.

Is there a way to explicitly extract those in trimesh?

And I need to compute the laplacian of the mesh (mass and stiffness matrices),

I see that you use the laplacian as part of some of the modules.

Is there a way to explicitly extract those in trimesh?

and laplacian smoothing: https://github.com/mikedh/trimesh/blob/master/trimesh/smoothing.py

Hello! I hope you are doing well. I cannot import Trimesh in python 2.7.12 on Ubuntu 16.04. Can anyone help me with this issue? Thanks!

i have error

File "/usr/local/lib/python3.6/site-packages/trimesh/path/path.py", line 1311, in simplify_spline

smooth=smooth)

TypeError: simplify_spline() got an unexpected keyword argument 'path_indexes'

smooth=smooth)

TypeError: simplify_spline() got an unexpected keyword argument 'path_indexes'

a = trimesh.load_path(cycloidal_profile(count_pin=count_pin,

count_cam=count_pin - 1,

eccentricity=eccentricity,

radius_pin=radius_pin,

radius_pattern=radius_pattern,

resolution=32))

count_cam=count_pin - 1,

eccentricity=eccentricity,

radius_pin=radius_pin,

radius_pattern=radius_pattern,

resolution=32))

```
print(a)
# replace the polyline entity with a bajillion points with a
# tightly fit B-Spline
a = a.simplify_spline(smooth=1e-6)
```