Skip to content

Bugs in ops.mesh.check_sign() triggered under special circumstances #566

Description

@Xiaoyao-Li

Bugs in ops.mesh.check_sign() triggered under special circumstances

We found that if a point is in a sepcific axis, the check_sign is invalid for some primitive meshes.

from kaolin.ops.mesh import check_sign, index_vertices_by_faces
import trimesh as tm
import torch
# we test the check_sign function
x_points = torch.Tensor([[[1, 0, 0]]])
y_points = torch.Tensor([[[0, 1, 0]]])
z_points = torch.Tensor([[[0, 0, 1]]])
# e.g. When the test primitive is Sphere, check_sign is incorrect on x/y-axis
sphere_mesh = tm.primitives.Sphere(radius=2.0, subdivision=3)
points = z_points
print(f'trimesh contains() result: {sphere_mesh.contains(points.squeeze(0))}')
print(f'check_sign() result: {check_sign(torch.Tensor(sphere_mesh.vertices).unsqueeze(0), torch.Tensor(sphere_mesh.faces).long(), points)}')

Note that the cast a ray from the point is a really smart idea, and it is valid for most of points in our test, we don't know if this is an imperfection in the implementation.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions