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?

  • 1
    $\begingroup$ 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 $\endgroup$
    – MarcoB
    Commented Dec 1, 2015 at 15:56
  • $\begingroup$ 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] $\endgroup$
    – Dimitris
    Commented Dec 1, 2015 at 15:59
  • 1
    $\begingroup$ So the function IntCyl determines whether two cylinders intersect? How is it different than the int function from this answer? $\endgroup$
    – Jason B.
    Commented Dec 1, 2015 at 15:59
  • 1
    $\begingroup$ I would be more worried that IntCyl fails a test case. $\endgroup$
    – Jason B.
    Commented Dec 1, 2015 at 16:07
  • 4
    $\begingroup$ 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/… $\endgroup$
    – Dimitris
    Commented Dec 1, 2015 at 16:13


Browse other questions tagged or ask your own question.