0

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?

Dimitris
  • 4,794
  • 22
  • 50
  • 1
    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 – MarcoB Dec 01 '15 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] – Dimitris Dec 01 '15 at 15:59
  • 1
    So the function IntCyl determines whether two cylinders intersect? How is it different than the int function from this answer? – Jason B. Dec 01 '15 at 15:59
  • I found the code here: https://m.reddit.com/r/Mathematica/comments/3eic0a/is_regionintersection_broken/?ref=readnext Although, as I said, the reply I got is certainly an excellent one I was wondering if we can achieve the same result (and performance) using directly built-in functions of Mathematica. – Dimitris Dec 01 '15 at 16:03
  • 1
    I would be more worried that IntCyl fails a test case. – Jason B. Dec 01 '15 at 16:07
  • 4
    I got it:-)! Thanks a lot. So, I will stick with the answer I got here http://mathematica.stackexchange.com/questions/100623/generating-randomly-oriented-non-intersecting-cylinders/100662#100662 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 http://mathematica.stackexchange.com/questions/100623/generating-randomly-oriented-non-intersecting-cylinders?noredirect=1#comment273097_100623 – Dimitris Dec 01 '15 at 16:13

0 Answers0