Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filterBySFValue does not support Meshes #176

Open
N4VDI opened this issue Jun 21, 2024 · 2 comments
Open

filterBySFValue does not support Meshes #176

N4VDI opened this issue Jun 21, 2024 · 2 comments

Comments

@N4VDI
Copy link

N4VDI commented Jun 21, 2024

Currently filterBySFValue does not seem to support Mesh, only Point Clouds.
On a mesh entity it throws an error

incompatible function arguments. The following argument types are supported:
    1. (arg0: float, arg1: float, arg2: _cloudComPy.ccPointCloud) -> _cloudComPy.ccPointCloud

CloudCompare does support filtering by scalar field values for Meshes https://www.cloudcompare.org/doc/wiki/index.php/Scalar_fields%5CFilter_by_Value (since 2.13 alpha?)
Would be nice if CloudComPy also supports it via the filterBySFValue API

(already posted in Gitlab issues-2, but as this seems to be the preferred place (again) for issues also creating it here, sorry for the dup.)

@prascle
Copy link
Collaborator

prascle commented Jun 24, 2024

Hello, I am sorry, i did not see your post on GitLab.

The CloudComPy Gitlab repository was created as a backup when I had problems with my Github account. Gitlab did not send me an email notification for your issue, I will fix my Gitlab configuration and maintain an up to date backup on Giltab. Anyway, Github is the prefered place for issues.

You are right, filterBySFValue does not support meshes, only clouds.
I will add the necessary methods for meshes in the next release.

It is possible to do something similar, but not equivalent, with the cloud associated to the mesh.
In the following example, the cloud associated to the mesh is filtered, and a mesh is built on this cloud. The holes are meshed, which is not the case with the CloudCompare method.

import os
import sys
import math

os.environ["_CCTRACE_"]="ON"

from gendata import getSampleCloud, dataDir
import cloudComPy as cc

cloud = cc.loadPointCloud(getSampleCloud(5.0))
cloud.exportCoordToSF(False, False, True)
mesh=cc.ccMesh.triangulate(cloud, cc.TRIANGULATION_TYPES.DELAUNAY_2D_AXIS_ALIGNED, dim=2)

mesh1=mesh.cloneMesh()
cloud1=mesh1.getAssociatedCloud()
filterCloud1=cloud1.filterPointsByScalarValue(0.4, 3, False)
filterMesh1=cc.ccMesh.triangulate(filterCloud1, cc.TRIANGULATION_TYPES.DELAUNAY_2D_AXIS_ALIGNED, dim=2)

cc.SaveEntities([cloud, cloud1, filterCloud1, mesh, mesh1, filterMesh1], os.path.join(dataDir, "filterMesh.bin"))

Best regards,
Paul

@N4VDI
Copy link
Author

N4VDI commented Jun 27, 2024

Hello, np, I understand the tech problems you had.

Yes, looked at the workaround, but found that for the use case the surface/mesh reconstruction from point cloud was not ideal, introducing too much artifacts and/or need for (manual) tweaking. Tried with Delaunay and qPoissonRecon methods.

Thanks for taking it up in the next release, looking forward to it!

prascle added a commit to prascle/CloudComPy that referenced this issue Aug 19, 2024
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

No branches or pull requests

2 participants