2
$\begingroup$

I want to draw a partition of an arbitrary 3D polyhedron like this drawing.

Where can I find examples of how to draw this?

enter image description here

Upd:

For example, I have this code on python

m = 45
partition = [[23, 24, 2, 25, 26, 27, 7, 28, 29, 3, 30, 31, 14, 32, 33, 1, 0], [24, 17, 25, 23, 34, 35, 36, 22, 30, 37, 19, 31, 38, 18, 39], [4, 35, 40, 24, 34, 20, 11, 41, 30, 37, 28, 42, 33, 32, 13, 12, 21], [24, 35, 26, 16, 15, 36, 8, 41, 5, 40, 27, 6, 9, 39, 43, 38, 44, 23, 29, 10, 28, 42]]
points = [[-0.20710678118654746, -0.20710678118654746, 0.5], [-0.35355339059327373, -0.35355339059327373, 0.35355339059327373], [-0.35355339059327373, 0.35355339059327373, 0.35355339059327373], [-0.20710678118654746, 0.20710678118654746, 0.5], [0.5, -0.20710678118654746, -0.20710678118654746], [0.5, 0.20710678118654746, -0.20710678118654746], [0.20710678118654746, 0.5, 0.20710678118654746], [-0.20710678118654746, 0.5, 0.20710678118654746], [0.5, 0.20710678118654746, 0.20710678118654746], [0.35355339059327373, 0.35355339059327373, 0.35355339059327373], [0.20710678118654746, 0.20710678118654746, 0.5], [0.5, -0.20710678118654746, 0.20710678118654746], [0.20710678118654746, -0.20710678118654746, 0.5], [0.35355339059327373, -0.35355339059327373, 0.35355339059327373], [-0.7071067811865475, 0.0, 0.0], [0.35355339059327373, 0.35355339059327373, -0.35355339059327373], [0.20710678118654746, 0.5, -0.20710678118654746], [-0.35355339059327373, 0.35355339059327373, -0.35355339059327373], [-0.20710678118654746, 0.5, -0.20710678118654746], [-0.35355339059327373, -0.35355339059327373, -0.35355339059327373], [0.35355339059327373, -0.35355339059327373, -0.35355339059327373], [0.0, -0.7071067811865475, 0.0], [0.0, 0.0, -0.7071067811865475], [-0.2824105505829383, 0.4247008996483171, -0.13705193185085648], [-0.02048188208948376, -0.01571424304076291, -0.01743874711809676], [-0.49806108666697857, 0.20904227237865944, -0.209045063679455], [-0.20710804045379536, 0.5000004446965807, 0.16190362960014762], [-0.1860300020235808, 0.49999812977709335, 0.2071089405020803], [0.12268057204041909, -0.005082997932443401, 0.499996491348166], [-0.00931983295438987, 0.2071071079673102, 0.4999977236555634], [-0.3206566352385273, -0.38644733328441644, -0.15677218363806888], [-0.48159060502762374, -0.2255153297585916, -0.22551726849858902], [0.00032108123217798964, -0.2071067019060003, 0.5000019952637891], [-0.24363815128018354, -0.46346242144613514, 0.2436419734397271], [0.3013193865154568, -0.30133316310518343, -0.4057777203267997], [0.3384181722613934, 0.00866654027637278, -0.3686918868729873], [0.30881336789975355, 0.3088202082474216, -0.3982891162766628], [-0.2403681923428138, -0.46673647792715633, -0.24037111350962848], [-0.1927414165848333, 0.4999975805569351, -0.20711009551652088], [-0.20710856459360286, 0.5000017834070557, -0.16321725869229695], [0.49999879511484707, -0.04251680401656357, -0.20710645976695208], [0.4999960380431533, -0.03236895298986859, 0.207107581402605], [0.2071109676453297, -0.14497532187633846, 0.4999992902408488], [-0.03380956932061133, 0.4548601941166912, -0.25224658706985625], [-0.03392324018536094, 0.018480809098675582, -0.026412841964440804]]

Here, the partition stores indexes from points of the corresponding polyhedra of the partition. I want to draw them preferably in different colors and preferably with a little transparency. How can I do this? (m = 45 number of points of the split polyhedron)

$\endgroup$
1
  • 1
    $\begingroup$ Note, image is taken from HERE where there is already good starting code. $\endgroup$ Nov 16, 2021 at 0:41

1 Answer 1

1
$\begingroup$

Edit

The updated question maybe

Clear[partition, points];
partition = {{23, 24, 2, 25, 26, 27, 7, 28, 29, 3, 30, 31, 14, 32, 33,
     1, 0}, {24, 17, 25, 23, 34, 35, 36, 22, 30, 37, 19, 31, 38, 18, 
    39}, {4, 35, 40, 24, 34, 20, 11, 41, 30, 37, 28, 42, 33, 32, 13, 
    12, 21}, {24, 35, 26, 16, 15, 36, 8, 41, 5, 40, 27, 6, 9, 39, 43, 
    38, 44, 23, 29, 10, 28, 42}};
partition = partition + 1;
points = {{-0.20710678118654746, -0.20710678118654746, 
    0.5}, {-0.35355339059327373, -0.35355339059327373, 
    0.35355339059327373}, {-0.35355339059327373, 0.35355339059327373, 
    0.35355339059327373}, {-0.20710678118654746, 0.20710678118654746, 
    0.5}, {0.5, -0.20710678118654746, -0.20710678118654746}, {0.5, 
    0.20710678118654746, -0.20710678118654746}, {0.20710678118654746, 
    0.5, 0.20710678118654746}, {-0.20710678118654746, 0.5, 
    0.20710678118654746}, {0.5, 0.20710678118654746, 
    0.20710678118654746}, {0.35355339059327373, 0.35355339059327373, 
    0.35355339059327373}, {0.20710678118654746, 0.20710678118654746, 
    0.5}, {0.5, -0.20710678118654746, 
    0.20710678118654746}, {0.20710678118654746, -0.20710678118654746, 
    0.5}, {0.35355339059327373, -0.35355339059327373, 
    0.35355339059327373}, {-0.7071067811865475, 0.0, 
    0.0}, {0.35355339059327373, 
    0.35355339059327373, -0.35355339059327373}, {0.20710678118654746, 
    0.5, -0.20710678118654746}, {-0.35355339059327373, 
    0.35355339059327373, -0.35355339059327373}, {-0.20710678118654746,
     0.5, -0.20710678118654746}, {-0.35355339059327373, \
-0.35355339059327373, -0.35355339059327373}, {0.35355339059327373, \
-0.35355339059327373, -0.35355339059327373}, {0.0, \
-0.7071067811865475, 0.0}, {0.0, 
    0.0, -0.7071067811865475}, {-0.2824105505829383, 
    0.4247008996483171, -0.13705193185085648}, {-0.02048188208948376, \
-0.01571424304076291, -0.01743874711809676}, {-0.49806108666697857, 
    0.20904227237865944, -0.209045063679455}, {-0.20710804045379536, 
    0.5000004446965807, 0.16190362960014762}, {-0.1860300020235808, 
    0.49999812977709335, 
    0.2071089405020803}, {0.12268057204041909, -0.005082997932443401, 
    0.499996491348166}, {-0.00931983295438987, 0.2071071079673102, 
    0.4999977236555634}, {-0.3206566352385273, -0.38644733328441644, \
-0.15677218363806888}, {-0.48159060502762374, -0.2255153297585916, \
-0.22551726849858902}, {0.00032108123217798964, -0.2071067019060003, 
    0.5000019952637891}, {-0.24363815128018354, -0.46346242144613514, 
    0.2436419734397271}, {0.3013193865154568, -0.30133316310518343, \
-0.4057777203267997}, {0.3384181722613934, 
    0.00866654027637278, -0.3686918868729873}, {0.30881336789975355, 
    0.3088202082474216, -0.3982891162766628}, {-0.2403681923428138, \
-0.46673647792715633, -0.24037111350962848}, {-0.1927414165848333, 
    0.4999975805569351, -0.20711009551652088}, {-0.20710856459360286, 
    0.5000017834070557, -0.16321725869229695}, {0.49999879511484707, \
-0.04251680401656357, -0.20710645976695208}, {0.4999960380431533, \
-0.03236895298986859, 
    0.207107581402605}, {0.2071109676453297, -0.14497532187633846, 
    0.4999992902408488}, {-0.03380956932061133, 
    0.4548601941166912, -0.25224658706985625}, {-0.03392324018536094, 
    0.018480809098675582, -0.026412841964440804}};
HighlightMesh[
    ConvexHullMesh[points[[#]]], {Style[1, None], 
     Style[2, Opacity[.5], RandomColor[]]}] & /@ partition // Show

enter image description here

Original

Not so effective.Voronoi mesh.

Clear[pts, regs];
pts = {{1, 0, 1}, {0, 1/2, 1}, {0, 1, 2/3}, {1, 1, 1/10}, {1/3, 1/2, 
    1}};
regs = And @@@ 
   Table[EuclideanDistance[pts[[i]], {x, y, z}] <= 
     EuclideanDistance[pts[[j]], {x, y, z}], {i, Length[pts]}, {j, 
     Complement[Range[Length[pts]], {i}]}];
Show[RegionPlot3D[regs, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, Mesh -> None,
   PlotPoints -> 30, PlotStyle -> Opacity[.5], Boxed -> False, 
  Axes -> False, ViewPoint -> {2.43, 1.76, 2.23}], 
 Graphics3D[{PointSize[Large], Point[pts]}]]

enter image description here

$\endgroup$
1
  • $\begingroup$ You are making a Voronoi diagram, and I want to draw a specific partition of a specific polyhedron. $\endgroup$
    – Vosatorp
    Nov 16, 2021 at 9:32

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.