0
$\begingroup$

I'm using th following way to produce solid spheres for random microstructures. I'm trying to find a way to produce solid ellipsoids with the same way. Does anyone have any idea?

I have already a code for ellipsoids producing the centers and the 3 radius (rλ1,rλ2,rλ3) in each direction, but if I plot Ellipsoid ... then I will take hollow spheres. That's the reason I am trying using this way.

Centers ,X, have produced by an algorithm and they have an array structure.enter image description here

    centers = X;
unitball[c_, x_] := EuclideanDistance[c, x] <= r;
regs = Show[
  RegionPlot3D[
     unitball[#, {x, y, z}], {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, 
     Mesh -> False, Boxed -> False, Axes -> False, 
     PlotPoints -> 100] & /@ centers]
$\endgroup$
1
  • $\begingroup$ Please provide a minimal working example of your code. That will increase your chance to get helpful answers. $\endgroup$ Commented Apr 16, 2021 at 13:36

2 Answers 2

1
$\begingroup$

Try ( r: list of semiaxes)

unitelli[c_, r_, x_ ] := Total[ (x - c)^2/r^2] < 1 

RegionPlot3D[
 unitelli[{2, 1, 3}, {1, 1/2, 2}, {x, y, z}], {x, 0, 5}, {y, 0, 
  4}, {z, 0, 4}, Mesh -> False , PlotPoints -> 50, 
 AxesLabel -> {x, y, z}, Axes -> False]

enter image description here

$\endgroup$
0
$\begingroup$
n = 10;
centers = RandomReal[1, {n, 3}];
radius = RandomReal[{.1, .2}, {n, 3}]; 
Table[RegionPlot3D[
   RegionIntersection[
    BoundaryDiscretizeRegion[Ellipsoid[centers[[i]], radius[[i]]]], 
    BoundaryDiscretizeRegion@Cuboid[]]], {i, n}] // Show

enter image description here

$\endgroup$

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.