Skip to content

Applying certains transforms when creating a mesh based on revolve ends with is_volume == False #2439

@spichardo

Description

@spichardo

Hi

I found this weird error when updating to the latest version of trimesh (4.7.3). I spotted this issue when trying to do some boolean operations and trimesh complained one of the meshes was not a volume.

If you create a simple cone mesh with a transform to flip the object in any of the directions (i.e. Z), it ends with is_volume == False

Transform=np.eye(4)
Transform[2,2]=-1
cone=trimesh.creation.cone(20,10,transform=Transform)
print('Cone is a volume =',cone.is_volume)

Cone is a volume = False

But if you apply the transformation after creating the object, it remains valid as a volume

cone=trimesh.creation.cone(20,10)
cone.apply_transform(Transform)
print('Cone is a volume =',cone.is_volume)

Cone is a volume = True

The documentation is clear that the transformation is applied after creation if passed when creating the object, but somehow this is not done exactly as if done in user code.

The error also shows when creating a cylinder, but not with a non-revolve-based mesh, such as a box.

box=trimesh.creation.box([5,10,20],transform=Transform)
print('Box is a volume =',box.is_volume)

Box is a volume = True

This bug seems independent of numpy version (tested it 1.24.3 and 2.0.2)

Cheers,

Sam

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