Comments (7)
hi ..so your meshes are almost overlapping?
You maybe can try by measuring the distainces of the 2 meshes and then cut with the computed scalar
https://vedo.embl.es/autodocs/content/vedo/vedo/pointcloud.html#Points.cut_with_scalar
https://vedo.embl.es/autodocs/content/vedo/vedo/pointcloud.html#Points.distance_to
mesh1.distance_to(mesh2, signed=True)
mesh1.cut_with_scalar(0, "Distance")
also have you tried
https://vedo.embl.es/autodocs/content/vedo/vedo/mesh.html#Mesh.intersect_with
from vedo.
Yes, I projected the meshes to the same plane. I have something like a tunnel that changes its shape and have to find the area that is common along the tunnel length. So in the example that I've sent the shapes are pretty similar as the distance in the tunnel was very small but the shape can vary much more.
The approach with distances leads to similar results as before.
While intersect_with returns a collection of lines.
I also tried to find the points that are included in all shapes that I compare, but in the end I don't know how I could reconnect the points to an area again.
from vedo.
Sorry from what you have sent it is not clear to me at all what the "tunnel" is or where it is in the image.
Also if you projected on the "same plane" it means the 2 objects are coplanar - and in fact you have got lots of intersections.. so there is no space inbetween?
What is the red sphere?
from vedo.
Ah sorry. I made a sketch to clarify my problem. I think I spent too much time with it already :)
(1)
So the blue thing is my tunnel (I simplified the shape). And the green circles are the shape of the tunnel at specific heights, aka I intersect the tunnel with planes that are parallel to the yellow plane and save the intersection polygon. These intersections led to the blue and green shape that I posted earlier.
(2)
Then I project all my intersections onto the yellow plane. I want to find the red area that is common for all intersection polygons (green circles).
This projection is what I sent earlier. I didn't include images with the tunnel. The tunnel is made out of a vedo mesh.
The sphere is a landmark that's not used in this case, I just didn't take it out of the visualization. :)
I hope that makes it clearer? If not please let me know!
from vedo.
Ok now it is more clear..
you may create a copy of the 3d circles and shift it forward (and/or backwards along the normal) and form a cylindrical Ribbon
mesh. You use then this mesh to .cut_with_mesh()
the other ones that would be created in the same way until you are only left with the intersection. You may need to use .slice()
to create a filled circle to be cut.
from vedo.
I'm not 100% sure if I understand correctly what you want to do with the ribbon. As far as I interpreted it the Ribbon fills the space between two boundaries/circles.
This works find for me if the meshes are a tiny bit apart but when I put them into the same plane they start to do funny things
Here in pink the ribbon.
I get my ribbon by:
intersection_circle = tunnel_mesh.intersect_with_plane(origin=new_center, normal=normal).join(reset=True)
mslices = vedo.pointcloud.merge(intersection_circle).color(color[distance])
mslices_boundaries = mslices.boundaries()
(I'm doing this for multiple outlines)
ribbon_mesh = Ribbon(mslices_boundaries_0, mslices_boundaries_1, closed =True, mode = 1).color('pink')
Results for mode 0 and mode 1 are not the same but similar in the problem. Setting closed = False also didn't help.
Also, in my tunnel the walls can sometimes touch in the middle so I have two separate circles or more at the same intersection height.
I do appreciate your help a lot!
from vedo.
You can play around with a test case to find the strategy that best fits your problem, consider this as a starting point:
from vedo import *
ln = [[sin(x), cos(x), x / 2] for x in np.arange(6,9, 0.1)]
N = len(ln)
radii = [0.3*(cos(6.0*ir/N))**2+0.1 for ir in range(N)]
tube = Tube(ln, r=radii, res=48).triangulate()
n = (0.3,-1,0)
slices = []
for i in range(-3, 6):
sli = tube.slice(origin=[0,i/10,0], normal=n)
sli.c("b9").bc("k5").lighting("off").pickable(True)
# sli = tube.intersect_with_plane(origin=[0,i/10,0], normal=n)
sli.reorient(n, [0,0,1])
slices.append(sli)
show([tube, slices], N=2, sharecam=0, axes=1)
from vedo.
Related Issues (20)
- Arrow object's top point HOT 2
- Group objects HOT 1
- Help ! Legosurface Error HOT 2
- version 2024.5.2 `show()` function returns error HOT 4
- quality and resolution of the video HOT 3
- Make load functions compatible with pathlib.Path HOT 1
- Creating a plot with objects out of scene, seems to break calls to render HOT 1
- Mesh.volume() and Mesh.is_closed() don't work with Boxes and Cylinders HOT 1
- compute_normals() unexpectedly changes the appearance of a Mesh HOT 2
- Cut volume with volume HOT 1
- seg fault on vertex normal and texture indices in obj format to off conversion HOT 2
- Issues with boolean operation HOT 4
- Touching objects handling in isosurface_discrete HOT 10
- Problems with boolean operations on concave polyhedrons HOT 4
- Problem with mesh formation
- mesh.cells datatype HOT 2
- Axes order of numpy array HOT 2
- computing volume of intersecting concave polyhedra HOT 1
- 2D images become non-pickable after changing cmap HOT 2
- Docs cannot be accessed due to certificate expiration HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vedo.