Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Recently I have used Mathematica to simulate the concrete structure. The most important point is generate random concrete aggregate. As you know, concrete aggregate can be looked as a polyhedron.

We can use ConvexHull to generate polyhedron.


data3D = {{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}};

{pts, surface} = TetGenConvexHull[data3D];
Graphics3D[GraphicsComplex[pts, Polygon[surface]]];

enter image description here

Question 1: How to define two polyhedron intersect or not?

I have written a Module, But its speed is very slow.

Question 2: When the concrete aggregate become more and more in a cubic region, it is very difficult to add new aggregate in the region, How can deal with this problem ?

The key is define the space relationship between line(segment) and plane(triangle):

HelenFormulaofTriangle[triangle_] := Module[
   {a, b, c, p},

   a = Norm[(triangle[[1]] - triangle[[2]])];
   b = Norm[(triangle[[1]] - triangle[[3]])];
   c = Norm[(triangle[[2]] - triangle[[3]])];

   p = 0.5*(a + b + c);

   Sqrt[p*(p - a)*(p - b)*(p - c)]



PointInandOnorOut3DTriangle[point_, triangle_] := Module[

    HelenFormulaofTriangle[{point, triangle[[1]], triangle[[2]]}] + 
      HelenFormulaofTriangle[{point, triangle[[1]], triangle[[3]]}] + 
      HelenFormulaofTriangle[{point, triangle[[2]], triangle[[3]]}] > 



enter image description here

share|improve this question
For the first question, do you mean "how to decide if 2 polyhedrons are intersecting"? Then, I can't understand your second question very well. – xzczd Jul 19 '14 at 3:31
Could you show the code you have so far? – user21 Jul 19 '14 at 6:35
Yes,I mean how to decide if 2 polyhedrons are intersecting – YuYong Jul 19 '14 at 6:39
Please have a look at this and format your code just as @jtbandes did for you. – xzczd Jul 19 '14 at 6:55
Well, if you want to call someone who isn't the original poster that appearing in the comment, you need to add @someone in your comment, or others won't see the reminder. RegionIntersection can be used for 3D object, for example d1 = {{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}}; d2={{0,0,0},{1/2,1/2,1/2},{1,0,0},{1,1,0}};r=RegionIntersection@@(Tetrahedron/@{‌​d1,d2});RegionMember[r,{x,y,z}]//Reduce – xzczd Jul 21 '14 at 3:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.