-
Notifications
You must be signed in to change notification settings - Fork 265
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
how to speed up cut_with_mesh? #1004
Comments
Thank you very much. I will try it. |
If Is it possible to create the box with |
You may obtain the result by using 6 planes with |
I have tried it, but the result is wrong. My code is:
The test data is: The result of code is: The four gray planes is used to cut the mesh. I hope the region included by the planes is cutted. But nothing is cutted. Any suggestion is appreciated~~~ |
This seems to do the job: import numpy as np
import vedo
mesh1 = vedo.Mesh("data/before.obj").color("r5", 0.3)
# print(mesh1)
centers = np.array([
[25.54791, 131.9023, 570.03764],
[46.95663, 83.99182, 511.02341],
[58.50379, 42.54272, 577.24325],
[37.09508, 90.45326, 636.25748],
])
normals = -np.array([ # NOTE THE MINUS SIGN
[0.34503, -0.93555, 0.07544],
[-0.07840, 0.05137, 0.99560],
[-0.34503, 0.93555, -0.07544],
[0.07840, -0.05137, -0.99560],
])
planes = []
for i in range(4):
p = vedo.Plane(centers[i], normals[i], s=[100, 100])
planes.append(p)
arrows = vedo.Arrows(centers, centers+normals*20, c="k")
mesh2 = mesh1.clone().cut_with_planes(centers, normals, invert=1)
mesh2.color("b5", 0.3)
vedo.show(planes, mesh2, arrows, axes=8) but to be honest I don't understand why flipping the normals is not equivalent to setting |
It is really weird. After add minus sign, it works for |
I have posted it in vtk forum: https://discourse.vtk.org/t/vtkclippolydata-incorrectly-work/13046 |
I have a complicate mesh, and I want to cut some region with a cube. I use
Mesh.cut_with_mesh
to do it.However, the mesh is very large so that the
cut_with_mesh
would cost 80s. Is it possible to speed up it? Or is there any other method which is faster?The text was updated successfully, but these errors were encountered: