# non-intersecting cylinders and DiscretizeRegion, RegionIntersection [duplicate]

This is a sequel to my previous post.

IntCyl[cyl1_, cyl2_] :=
RegionQ[DiscretizeRegion[RegionIntersection[cyl1, cyl2]] // Quiet]

cylinders =
Table[{RandomReal[{-100, 100}, {2, 3}], RandomReal[5]}, {10}];
cylinderslist = Cylinder[First@#, Last@#] & /@ cylinders;
Timing[nint =
Table[Or @@
Table[IntCyl[cylinderslist[[i]], cylinderslist[[j]]], {j, i + 1,
10}], {i, 10}];]
(*{142.887, Null}*)


Is it a way to iprove the performance of the code?

• I wonder if you might be interested in rolling your own intersection function. Determining whether two cylinders intersect is covered well in this document from the documentation of Geometric Tools: Intersection of Cylinders Commented Dec 1, 2015 at 15:56
• Thanks, I already know. The reply I got in my previous question is very helpful and it does what I want. The current post has to do more with the perfomance of DiscretizeRegion[RegionIntersection[cyl1, cyl2] Commented Dec 1, 2015 at 15:59
• So the function IntCyl determines whether two cylinders intersect? How is it different than the int function from this answer? Commented Dec 1, 2015 at 15:59
• I would be more worried that IntCyl fails a test case. Commented Dec 1, 2015 at 16:07
• I got it:-)! Thanks a lot. So, I will stick with the answer I got here mathematica.stackexchange.com/questions/100623/… and I try to follow the discussion of the afforementioned document from MarcoB. In the meantime, I may hope that @J.M. can elaborate more on his comment here mathematica.stackexchange.com/questions/100623/… Commented Dec 1, 2015 at 16:13