Skip to content

Conversation

@lucagrementieri
Copy link
Contributor

@lucagrementieri lucagrementieri commented Nov 11, 2025

The function trimesh.creation.revolve produces an additional set of faces linking the points at the beginning and at the end of the provided line.

For example running this snippet, the assertion fails because 48 faces are produced, i.e. 2*sections more than the expected number

import trimesh.creation
import numpy as np

line = np.array([[1.0, 0.0], [1.0, 1.0], [1.0, 2.0], [1.0, 3.0]])
t = trimesh.creation.revolve(line, cap=False, sections=6)
assert t.vertices.shape == (24, 3)
assert t.faces.shape == (36, 3)

Viewing the mesh in MeshLab we can notice the presence of problematic faces.
Screenshot 2025-11-11 alle 19 10 08

This PR fixes the problem by avoiding the creation of the spurious faces, recovering the expected result.
Screenshot 2025-11-11 alle 19 11 03

@mikedh mikedh changed the base branch from main to release/collision November 11, 2025 20:03
@mikedh mikedh merged commit 3e53f19 into mikedh:release/collision Nov 11, 2025
11 checks passed
mikedh added a commit that referenced this pull request Nov 11, 2025
@mikedh
Copy link
Owner

mikedh commented Nov 11, 2025

Thanks for the PR fix makes sense! It seems like we should have caught that somewhere in tests, although on quick inspection the area for a cylinder was coming out correctly with the prior logic?

@mikedh mikedh mentioned this pull request Nov 12, 2025
mikedh added a commit that referenced this pull request Nov 24, 2025
- release #2475 
- release #2474 
- release #2483 
- release #2481 
- release #2486 
- release #2480
- this applies the March 2024 deprecation removing
`Trimesh.remove_degenerate_faces` and `Trimesh.remove_duplicate_faces`.
- moves the `SceneViewer` control instructions from the README to print
on the `h` keypress, and make the default window caption include `h for
help`
- remove `psutil` from dependencies. It was only used to check if a
`scipy.spatial.cdist` call was going to use more than 50% of free system
memory before falling back to a more memory-efficient but slower loop.
This now falls back to a looping method if the `cdist` call is going to
use more than a fixed `4 GB` of memory,
- add check that primitives (i.e. `Cylinder`) mostly override `area` and
`volume` by checking that their primitive area/volume is not exactly
floating point equal to their meshed volume. This caught that `Capsule`
didn't return analytical volume/area which was also fixed. We could
probably make Primitive a multiple inheritance ABC that requires certain
properties but since Primitive already inherits from Trimesh that seems
unnecessary and confusing.
- clean up references to OpenCTM, which [was
deprecated](trimesh/openctm#5) for low use,
being unmaintained, and inflicting a burden on upstream package
management.
- docker images now build with 3.14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants