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

Extrude until contact/overlap #1077

Open
JeffreyWardman opened this issue Mar 20, 2024 · 3 comments
Open

Extrude until contact/overlap #1077

JeffreyWardman opened this issue Mar 20, 2024 · 3 comments

Comments

@JeffreyWardman
Copy link
Collaborator

I'd like a way to run mesh.extrude() where it extrudes until contact with the previous mesh (and then stops on a point by point basis). Is there a way to do this? At the moment some parts exceed through the mesh.

@JeffreyWardman JeffreyWardman changed the title Extrude until overlap Extrude until contact/overlap Mar 20, 2024
@marcomusy
Copy link
Owner

Yes - I will try implementing it now.

@marcomusy
Copy link
Owner

I implemented this but i'm not sure if it works the intended way (i may not understand the vtk filter...):
https://vedo.embl.es/autodocs/content/vedo/vedo/mesh.html#Mesh.extrude_and_trim_with

Also there is another possibility by "sweeping" a Line along a spline:

from vedo import *

sphere = Sphere([-1,0,4]).rotate_x(25).wireframe().color('r')
circle = Circle([0,0,0], r=2, res=100).color('b6')

extruded_circle = circle.extrude_and_trim_with(
    sphere, 
    direction=[0,-0.2,1],
    strategy="bound",
    cap=True,
    cap_strategy="intersection",
)

circle.lw(3).c("tomato").shift(dz=-0.1)

show(circle, sphere, extruded_circle, axes=1).close()

and:

from vedo import *

aline = Line(Circle().coordinates)
spline = Spline([(0,0,0), (1,1,1), (2,3,3), (1,1,4), (0,1,5)]).lw(5)
pts = spline.coordinates

surfs = []
for i in range(1, len(pts)-1):
    p0, p1 = pts[i-1:i+1]
    surf = aline.sweep(p1 - p0)
    surfs.append(surf)
surface = merge(surfs, flag=True)
surface.c("gold").lw(0.1).pickable(True)

show(spline, surface, aline, axes=1).close()

Screenshot from 2024-03-22 10-51-49

@marcomusy
Copy link
Owner

Oh I forgot the other option is to use Ribbon() and then merge the pieces the same way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants