0
$\begingroup$

Is there a simple way for me to determine if a cylinder a and cylinder b overlap in the 3D space? I have spent a few hours looking into this, but haven't yet found a solution.

For a little while, I thought that MemberRegion[] might be useful, but it does not seem to be working in 3 dimensions.

For example, here two cylinders are overlapping

For example, here, above, two cylinders are overlapping

$\endgroup$

1 Answer 1

4
$\begingroup$
Region@RegionIntersection[ 
   Cylinder[{{0, 0, 0}, {1, 1, 1}}, 2],   
   Cylinder[{{0, 1, 0}, {0, 1, 1}}, 4]]

enter image description here

or

RegionDimension@
 RegionIntersection[ 
   Cylinder[{{0, 0, 0}, {1, 1, 1}}, 2],  
   Cylinder[{{0, 1, 0}, {0, 1, 1}}, 4]]

(* 3 *)

$\endgroup$
2
  • $\begingroup$ Thanks! I had thought, for some reason, that RegionIntersection[] didn't account for the {x,y,z} position! $\endgroup$
    – Jmeeks29ig
    Commented Jan 30, 2019 at 3:36
  • $\begingroup$ How could it not??? $\endgroup$ Commented Jan 30, 2019 at 4:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.