-
Hi everyone, I need some help with a simple code that I made to estimate volume. I started with two intersecting cubes ( Dims = 10 x 10 x 10 ), and the only thing I did was move it 5 units on the y axis.
The output is this: How can I solve this? |
Beta Was this translation helpful? Give feedback.
Answered by
marcomusy
Feb 27, 2024
Replies: 1 comment
-
As you can see you have colliding faces! Allow a small tolerance to avoid it: from vedo import *
cube_a = Box(pos = (10,10,10), size=(10, 10, 10)).triangulate().alpha(0.2)
cube_b = Box(pos = (10,15,10), size=(10, 10, 10)).triangulate().c("purple5")
cube_a.scale(1.001) # make it a bit bigger to avoid colliding faces
intersection_ab= cube_a.boolean("intersect", cube_b).c('blue5')
print('Vol. Intersection = ', intersection_ab.volume())
show([[cube_a, cube_b], intersection_ab], N=2, axes=1, viewup='z').close()
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
marcomusy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As you can see you have colliding faces! Allow a small tolerance to avoid it: